-
Notifications
You must be signed in to change notification settings - Fork 0
Home
the file TWLogger.h and TWLogger.cpp is the core implement of logger.
you could Add above two files and TWSmartPointer.h to your project, and then use it to logger what you want to log.
- WRITE_INFO_LOG/PARAM
- WRITE_DEBUG_LOG/PARAM
- WRITE_WARN_LOG/PARAM
- WRITE_ERROR_LOG/PARAM
WRITE_LOG only convey a string to record while WRITE_PARAM can convey params just like printf
in C syntax
INFOR/DEBUG/WARN/ERROR indicates the error level which represents prefix mark in every record item in log file.
- LOG_FUNCTION()
- TRACE_FUNCTION(pValue)
the two above macro can record the Enter and Leave event about the specific functions, moreover, the TRACE_FUNCTION supports record returned value which type must be int-pointer or DWORD-pointer.
- WRITE_TRACE_PARAM records extern information contains code source file name and sentence line
-
LOG_ASSERT perform
ASSER()
function and record the assert-expression too !
- the log record will store in a folder named "LogFiles" at locate place where your executive program locates default useless you invoke
SetFileWriteMode
function before invoke WRITE* interfaces. - Every log file would store in locate disk formatted as 'YYYY-MM-dd.log'
the macro definition TWINKLE_LOGGER_VERSION in TWLogger.h defines two usaged format for the logger.
if no define TWINKLE_LOGGER_VERSION
or define TWINKLE_LOGGER_VERSION
as 1, it means:
Only one logger instance can exist in executive program.
if define TWINKLE_LOGGER_VERSION
as 2, you can:
you can create more than one logger instance with different 'logger name' through invoking GetLoggerFactory()->GetLoggerProduct(#logger-name#)
interface which would store 'logger-name' folder separately.
More detail please read and execute the LoggerTest.cpp as a usage demo...