NumXL SDK - Logging API
log_wchar.cpp

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

#include <windows.h>
#include <iostream>
#include <string>
#include "SFLOG.h"
int main(){
std::wstring szAppName = L"testapp";
std::wstring szLogDir =L"C:\\temp";
DWORD dwBackupFiles=7;
size_t ulMaxFileSize= (1024 * 1024); // 1 MB
unsigned int uClientToken=0;
int nRetCode = SFLOG_INITW(szAppName.c_str(),szLogDir.c_str(), dwBackupFiles, ulMaxFileSize,&uClientToken);
if(nRetCode == NDK_SUCCESS){
std::wcout << L" SUCCESS - Logging system is initialized .." << std::endl;
std::wstring szErrorMsg(L"Test message");
// Using helper macro, level: Error
SFLOG_MSG_ERROR_W((szErrorMsg.c_str()));
// Using the API
SFLOG_LOGMSGW(SFLOG_ERROR, __FILE__, __FUNCTION__, __FUNCSIG__, __LINE__, (szErrorMsg.c_str())) ;
std::wcout << L" Shutting down the Logging system ..." << std::endl;
SFLOG_SHUTDOWN(uClientToken);
}
return 0;
}
#define NDK_SUCCESS
SUCCESS return code.
Definition SFLOG.h:36
int __stdcall SFLOG_INITW(LPCWSTR szAppName, LPCWSTR szLogDir, DWORD dwBackupFiles, size_t ulMaxFileSize, unsigned int *pClientToken)
Initializes the logging facility of the NumXL SDK using Unicode strings for the logging base filename...
Definition SFLog.cpp:115
int __stdcall SFLOG_SHUTDOWN(unsigned int uClientToken)
Shutdown and release resources allocated by logging system.
Definition SFLog.cpp:296
#define SFLOG_MSG_ERROR_W(msg)
Helper macro for logging wide-character (unicode) message at error level.
Definition SFLOG.h:131
#define SFLOG_ERROR
Enable error level logging: error and fatal error messages.
Definition SFLOG.h:22
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.
Definition SFLog.cpp:529