NumXL SDK - Logging API
log_ascii.cpp

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

#include <windows.h>
#include <iostream>
#include <string>
#include "SFLOG.h"
int main(){
std::string szAppName = "testapp";
std::string szLogDir ="C:\\temp";
DWORD dwBackupFiles=7;
size_t ulMaxFileSize= (1024 * 1024); // 1 MB
unsigned int uClientToken=0;
int nRetCode = SFLOG_INITA(szAppName.c_str(),szLogDir.c_str(), dwBackupFiles, ulMaxFileSize,&uClientToken);
if(nRetCode == NDK_SUCCESS){
std::cout << " SUCCESS - Logging system is initialized .." << std::endl;
std::string szErrorMsg("Test message");
// Using helper macro, level: Error
SFLOG_MSG_ERROR_A((szErrorMsg.c_str()));
// Using the API
SFLOG_LOGMSGA(SFLOG_ERROR, __FILE__, __FUNCTION__, __FUNCSIG__, __LINE__, (szErrorMsg.c_str())) ;
std::cout << " 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_INITA(LPCSTR szAppName, LPCSTR szLogDir, DWORD dwBackupFiles, size_t ulMaxFileSize, unsigned int *pClientToken)
Initialize the logging system for SDK. This is often the first API call that an application makes and...
Definition SFLog.cpp:251
int __stdcall SFLOG_SHUTDOWN(unsigned int uClientToken)
Shutdown and release resources allocated by logging system.
Definition SFLog.cpp:296
#define SFLOG_MSG_ERROR_A(msg)
Output a narrow-character (ascii) message at error-level.
Definition SFLOG.h:161
#define SFLOG_ERROR
Enable error level logging: error and fatal error messages.
Definition SFLOG.h:22
int __stdcall SFLOG_LOGMSGA(int nLevel, LPCSTR szFilename, LPCSTR szFuncName, LPCSTR szFuncSig, int nLineNo, LPCSTR szMsg)
Log a narrow-character (i.e., ASCII) log message.
Definition SFLog.cpp:620