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

This is an example program how to use the multi-byte (wide) chanraterset version of the SFLOG functions.

This is an example program how to use the multi-byte (wide) 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::wstring szAppName = L"testapp";
11 std::wstring szLogDir =L"C:\\temp";
12 DWORD dwBackupFiles=7;
13 size_t ulMaxFileSize= (1024 * 1024); // 1 MB
14
15 unsigned int uClientToken=0;
16 int nRetCode = SFLOG_INITW(szAppName.c_str(),szLogDir.c_str(), dwBackupFiles, ulMaxFileSize,&uClientToken);
17 if(nRetCode == NDK_SUCCESS){
18 std::wcout << L" SUCCESS - Logging system is initialized .." << std::endl;
19
20 std::wstring szErrorMsg(L"Test message");
21
22 // Using helper macro, level: Error
23 SFLOG_MSG_ERROR_W((szErrorMsg.c_str()));
24
25 // Using the API
26 SFLOG_LOGMSGW(SFLOG_ERROR, __FILE__, __FUNCTION__, __FUNCSIG__, __LINE__, (szErrorMsg.c_str())) ;
27
28 std::wcout << L" 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_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...
#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.
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.
#define SFLOG_MSG_ERROR_W(msg)
Output a wide (multi-byte) character message at error-level.
Definition SFLOG.h:106