58 #define snprintf _snprintf
59 #define vsnprintf _vsnprintf
70 file.open( fileName.c_str(), ios_base::out );
74 fprintf( stderr,
"Could not open log file!\n" );
85 if (
file.is_open() ) {
122 const int buf_size = 1024;
128 snprintf( buf, buf_size,
"%s%s",
LevelLabels[level], pref.c_str() );
131 int len = strlen( buf );
132 char *end = buf + len;
133 vsnprintf( end, buf_size - len, format, ap );
144 std::string ret_str(
"");
151 va_start( marker, fmt );
153 const int buf_size = 1024;
157 vsnprintf( end, buf_size, fmt, marker );
224 _pref.assign( pref );
227 if (
_pref.size() > 0 ) {
245 va_start( ap, format );
262 va_start( ap, format );
279 va_start( ap, format );
296 va_start( ap, format );
313 va_start( ap, format );
void warn(const char *format,...)
'Warn' level.
void setPrefix(const char *pref)
void setCallback(LogCallback *lc)
static std::string format(const char *fmt,...)
const char * LevelLabels[5]
static Log * instance()
Returns the instance pointer, creating the object on the first call.
void setLevel(Level level)
void error(const char *format,...)
'Error' level.
void operator()(Log::Level level, const std::string &msg)
void operator()(Level level, const std::string &msg)
StdFileLogCallback(std::string fileName)
void set(Level level, std::string fileName, char const *pref="")
OstreamCallback(std::ostream &os)
void operator()(const char *format,...)
void info(const char *format,...)
'Info' level.
void FormatAndWrite(Log::LogCallback &lc, Log::Level level, std::string pref, const char *format, va_list ap)
void debug(const char *format,...)
'Debug' level.