siso_log.h Source File

siso_log.h
Go to the documentation of this file.
1
14#ifndef __SISO_LOG_H__
15#define __SISO_LOG_H__
16
17#if defined(_WIN32)
18#include <windows.h>
20typedef DWORD tProcessId;
22typedef DWORD tThreadId;
23#else
24#include <unistd.h>
25#include <pthread.h>
27typedef pid_t tProcessId;
29typedef pthread_t tThreadId;
30#endif
31
33#define SISOLOG_MODE_OFF 0
35#define SISOLOG_MODE_DEFAULT 1
36
38#define SISOLOG_LOGLEVEL_WARN 4
40#define SISOLOG_LOGLEVEL_ERROR 5
42#define SISOLOG_LOGLEVEL_FATAL 6
43
45#define SISOLOG_OK 0
47#define SISOLOG_ERROR_INTERNAL_ERROR -1
49#define SISOLOG_ERROR_LIB_NOT_LOADED -2
51#define SISOLOG_ERROR_LIB_ALREADY_LOADED -3
53#define SISOLOG_ERROR_UNRESOLVED_SYMBOL -4
54
55#pragma pack(push)
56#pragma pack(1)
57
61typedef struct tSisoLogTag {
62 tSisoLogTag(const char * n, const char * v) : name(n), value(v) {}
64 const char* const name;
66 const char* const value;
68
69#pragma pack(pop)
70
71/* callback function definitions */
72
84typedef void FuncType_LogMsgCallback(tProcessId pid, tThreadId tid, const char* const logger, unsigned int level, const char* const msg, unsigned int tagcount, const tSisoLogTag* const tags, void* userdata);
85
86#ifdef __cplusplus
87extern "C" {
88#endif
89
99
109
118int SisoLog_SetMode(unsigned int mode);
119
126int SisoLog_GetMode(unsigned int* mode);
127
136
137#ifdef __cplusplus
138}
139#endif
140
141#endif // __SISO_LOG_H__
int SisoLog_RegisterLogMsgCallback(FuncType_LogMsgCallback *callback, void *userdata)
Register the user callback for log events.
pthread_t tThreadId
Definition siso_log.h:29
struct tSisoLogTag tSisoLog_Tag
structure for logging tags
void FuncType_LogMsgCallback(tProcessId pid, tThreadId tid, const char *const logger, unsigned int level, const char *const msg, unsigned int tagcount, const tSisoLogTag *const tags, void *userdata)
Callback function definition for log events.
Definition siso_log.h:84
int SisoLog_GetMode(unsigned int *mode)
The function SisoLog_GetMode() returns the current mode for the library.
int SisoLog_FreeLibrary()
The function SisoLog_FreeLibrary() releases internal structures of the library.
int SisoLog_SetMode(unsigned int mode)
The function SisoLog_SetMode() set the mode for the library.
int SisoLog_InitLibrary()
The function SisoLog_InitLibrary() initializes internal structures of the library.
pid_t tProcessId
Definition siso_log.h:27
structure for logging tags
Definition siso_log.h:61
tSisoLogTag(const char *n, const char *v)
Definition siso_log.h:62
const char *const value
Definition siso_log.h:66
const char *const name
Definition siso_log.h:64