123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293 |
- #if !defined(LOG_H)
- #define LOG_H
- #if defined(_WIN32) || defined(_WIN64)
- #include <windows.h>
- #define thread_id_type DWORD
- #else
- #include <pthread.h>
- #define thread_id_type pthread_t
- #endif
- enum LOG_LEVELS {
- INVALID_LEVEL = -1,
- TRACE_MAXIMUM = 1,
- TRACE_MEDIUM,
- TRACE_MINIMUM,
- TRACE_PROTOCOL,
- LOG_ERROR,
- LOG_SEVERE,
- LOG_FATAL,
- };
- typedef struct
- {
- enum LOG_LEVELS trace_level;
- int max_trace_entries;
- enum LOG_LEVELS trace_output_level;
- } trace_settings_type;
- extern trace_settings_type trace_settings;
- #define LOG_PROTOCOL TRACE_PROTOCOL
- #define TRACE_MAX TRACE_MAXIMUM
- #define TRACE_MIN TRACE_MINIMUM
- #define TRACE_MED TRACE_MEDIUM
- typedef struct
- {
- const char* name;
- const char* value;
- } Log_nameValue;
- int Log_initialize(Log_nameValue*);
- void Log_terminate(void);
- void Log(enum LOG_LEVELS, int, const char *, ...);
- void Log_stackTrace(enum LOG_LEVELS, int, thread_id_type, int, const char*, int, int*);
- typedef void Log_traceCallback(enum LOG_LEVELS level, const char *message);
- void Log_setTraceCallback(Log_traceCallback* callback);
- void Log_setTraceLevel(enum LOG_LEVELS level);
- #endif
|