CScpp/Debug.h
author hh
Thu, 21 Nov 2019 14:55:10 +0100
changeset 0 5c129dd80d4f
permissions -rw-r--r--
--

#ifndef _DebugH_
#define _DebugH_ 1

class DebugC {		// independent utility staff
	public:
		static int debug;					// debug log level
		static char *prg_name;			// not used at the moment
		static long int t0;
		static sem_t semaphore;			// semafor for log timestamping
		static sem_t *semP;				// -->semafor for log timestamping
		static void debug_init(char *prgname);

		char s[256];						// debug msg workspace
		char debid[128];					// debug ID of process

		void pre(char *o);
		void deb(int level);
		void err(int level, char *o);
		void back_trace();
};
typedef DebugC *DebugP;

#define DEBID(...) sprintf(deP->debid, __VA_ARGS__)
#define LOG(level, ...) sprintf(deP->s, __VA_ARGS__), deP->deb(level)
#endif