SDK 1.69.1
Brief about SDK
Loading...
Searching...
No Matches
SFLOG.h
Go to the documentation of this file.
1
12#pragma once
13
14
15#define SFLOG_ALL 0
16#define SFLOG_TRACE 1
17#define SFLOG_DEBUG 2
18#define SFLOG_INFO 3
19#define SFLOG_WARN 4
20#define SFLOG_ERROR 5
21#define SFLOG_FATAL 6
22#define SFLOG_OFF 7
23
24#define SFLOG_ERRORS SFLOG_ERROR
25
26// Error codes (0-500) Common
27#define NDK_SUCCESS 0
28#define NDK_FAILED -1
29
30// TRUE/FALSE aliases
31#define NDK_TRUE 0
32#define NDK_FALSE 1
33
34#define NDK_UNINITIALIZED -11
35#define NDK_INIT_FAILED -20
36#define NDK_SKIP_INIT 105
37
38// Configuration file related error code
39#define NDK_MISSING_CONF -100
40#define NDK_BAD_CONF -101
41#define NDK_CONF_DATAPATH_INVALID -102
42#define NDK_DATAPATH_INVALID -103
43
44// General error codes
45#define NDK_MISSING_APP_ARG -106
46#define NDK_LOGFILE_INUSE -105
47
48#define NDK_INVALID_ARG -300
49#define NDK_LENGTH_ERROR -301
50#define NDK_INVALID_VALUE -302
51#define NDK_INVALID_TOKEN -303
52
53// Helper Macros
63#define SFLOG_MSG(msg, LEVEL, N) \
64 SFLOG_LOGMSG##N(SFLOG_##LEVEL, __FILE__, __FUNCTION__, __FUNCSIG__, __LINE__, msg)
65
76#define SFLOG_MSG_CHECK(condition, msg, LEVEL,N) \
77 if(!condition){SFLOG_MSG(msg,LEVEL,N);}
78
79
88#define SFLOG_MSG_W(msg,LEVEL) SFLOG_MSG(msg, LEVEL, W)
89
99#define SFLOG_MSG_CHECK_W(condition, msg, LEVEL) \
100 SFLOG_MSG_CHECK(condition, msg, LEVEL,W)
101
102
103#define SFLOG_MSG_DEBUG_W(msg) SFLOG_MSG(msg,DEBUG,W)
104#define SFLOG_MSG_INFO_W(msg) SFLOG_MSG(msg,INFO,W)
105#define SFLOG_MSG_WARN_W(msg) SFLOG_MSG(msg,WARN,W)
106#define SFLOG_MSG_ERROR_W(msg) SFLOG_MSG(msg,ERRORS,W)
107#define SFLOG_MSG_FATAL_W(msg) SFLOG_MSG(msg,FATAL,W)
108
109
118#define SFLOG_MSG_A(msg, LEVEL) SFLOG_MSG(msg, LEVEL, A)
119
129#define SFLOG_MSG_CHECK_A(condition, msg, LEVEL) \
130 SFLOG_MSG_CHECK(condition, msg, LEVEL,A)
131
132// Default debugging is for ASCII text
133
134// Helper Macros
135// #define SF_LOG_MSG(msg, LEVEL) \
136// SFLOG_LogMsgW(SFLOG_##LEVEL, __FILE__, __FUNCTION__, __FUNCSIG__, __LINE__, msg)
137// #define SF_CHECK_LOG(condition, msg, LEVEL) \
138// if(!condition){SF_LOG_MSG(msg,LEVEL);}
139
140// Default debugging is for ASCII text
141#define SFLOG_MSG_DEBUG(msg) SFLOG_MSG_A(msg,DEBUG)
142#define SFLOG_MSG_INFO(msg) SFLOG_MSG_A(msg,INFO)
143#define SFLOG_MSG_WARN(msg) SFLOG_MSG_A(msg,WARN)
144#define SFLOG_MSG_ERROR(msg) SFLOG_MSG_A(msg,ERRORS)
145#define SFLOG_MSG_FATAL(msg) SFLOG_MSG_A(msg,FATAL)
146
147
148// Functions API
149extern "C"
150{
153
178 int __stdcall SFLOG_INITW (LPCWSTR szAppName,
179 LPCWSTR szLogDir,
180 DWORD dwBackupFiles,
181 size_t ulMaxFileSize,
182 unsigned int* uClientToken
183 );
184
212 int __stdcall SFLOG_INITA(LPCSTR szAppName,
213 LPCSTR szLogDir,
214 DWORD dwBackupFiles,
215 size_t ulMaxFileSize,
216 unsigned int* uClientToken
217 );
218
219#ifdef UNICODE
225 #define SFLOG_INIT SFLOG_INITW
226#else
232 #define SFLOG_INIT SFLOG_INITW
233#endif // !UNICODE
234
253 int __stdcall SFLOG_SHUTDOWN(unsigned int uClientToken);
254
255
257
259
262
291 int __stdcall SFLOG_LOGMSGW(int nLevel,
292 LPCSTR szFilename,
293 LPCSTR szFuncName,
294 LPCSTR szFuncSig,
295 int nLineNo,
296 LPCWSTR szMsg
297 );
298
327 int __stdcall SFLOG_LOGMSGA(int nLevel,
328 LPCSTR szFilename,
329 LPCSTR szFuncName,
330 LPCSTR szFuncSig,
331 int nLineNo,
332 LPCSTR szMsg
333 );
334
335
336#ifdef UNICODE
342 #define SFLOG_LOGMSG SFLOG_LOGMSGW
343#else
349 #define SFLOG_LOGMSG SFLOG_LOGMSGA
350#endif // !UNICODE
351
352
360 int __stdcall SFLOG_GETLEVEL(unsigned int* nLevel );
368 int __stdcall SFLOG_SETLEVEL(unsigned int uClientToken,
369 unsigned int nLevel
370 );
371}
372
373
377
381
382
int __stdcall SFLOG_LOGMSGA(int nLevel, LPCSTR szFilename, LPCSTR szFuncName, LPCSTR szFuncSig, int nLineNo, LPCSTR szMsg)
Log a narrow-character (i.e., ASCII) message.
int __stdcall SFLOG_SETLEVEL(unsigned int uClientToken, unsigned int nLevel)
set the new logging level in the SDK
int __stdcall SFLOG_INITA(LPCSTR szAppName, LPCSTR szLogDir, DWORD dwBackupFiles, size_t ulMaxFileSize, unsigned int *uClientToken)
Initialize the logging system for SDK. This is often the first API call that an application makes and...
int __stdcall SFLOG_INITW(LPCWSTR szAppName, LPCWSTR szLogDir, DWORD dwBackupFiles, size_t ulMaxFileSize, unsigned int *uClientToken)
Initialize the logging system for SDK. This is often the first API call that an application makes and...
int __stdcall SFLOG_SHUTDOWN(unsigned int uClientToken)
Shutdown and release resources allocated by logging system.
int __stdcall SFLOG_GETLEVEL(unsigned int *nLevel)
An alias which automatically selects the ANSI or Unicode version of this function based on the defini...
int __stdcall SFLOG_LOGMSGW(int nLevel, LPCSTR szFilename, LPCSTR szFuncName, LPCSTR szFuncSig, int nLineNo, LPCWSTR szMsg)
Log a wide-character (i.e., wchar_t*) message.