SDK 1.69.1
Brief about SDK
Loading...
Searching...
No Matches
log_ascii.cpp

This is an example program how to use the ascii (narrow) chanraterset version of the SFLOG functions.

This is an example program how to use the ascii (narrow) chanraterset version of the SFLOG functions

1#include <windows.h>
2
3#include <iostream>
4#include <string>
5#include "SFLOG.h"
6
7
8int main(){
9
10 std::string szAppName = "testapp";
11 std::string szLogDir ="C:\\temp";
12 DWORD dwBackupFiles=7;
13 size_t ulMaxFileSize= (1024 * 1024); // 1 MB
14
15 unsigned int uClientToken=0;
16 int nRetCode = SFLOG_INITA(szAppName.c_str(),szLogDir.c_str(), dwBackupFiles, ulMaxFileSize,&uClientToken);
17 if(nRetCode == NDK_SUCCESS){
18 std::cout << " SUCCESS - Logging system is initialized .." << std::endl;
19
20 std::string szErrorMsg("Test message");
21
22 // Using helper macro, level: Error
23 SFLOG_MSG_ERROR_A((szErrorMsg.c_str()));
24
25 // Using the API
26 SFLOG_LOGMSGA(SFLOG_ERROR, __FILE__, __FUNCTION__, __FUNCSIG__, __LINE__, (szErrorMsg.c_str())) ;
27
28 std::cout << " Shutting down the Logging system ..." << std::endl;
29 SFLOG_SHUTDOWN(uClientToken);
30 }
31 return 0;
32}
33
header file for the public API of SFLOG library
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_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...
#define SFLOG_ERROR
Enable error level logging: error and fatal error messages.
Definition SFLOG.h:20
#define NDK_SUCCESS
SUCCESS return code.
Definition SFLOG.h:27
int __stdcall SFLOG_SHUTDOWN(unsigned int uClientToken)
Shutdown and release resources allocated by logging system.