EvEmu  0.8.4
11 September 2021
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
NewLog Class Reference

a small and simple logging system. More...

#include "LogNew.h"

Inheritance diagram for NewLog:
Collaboration diagram for NewLog:

Public Member Functions

 NewLog ()
 Primary constructor, initializes logging. More...
 
 NewLog (std::string logPath)
 
 ~NewLog ()
 Destructor, closes the logfile. More...
 
void Initialize ()
 
void InitializeLogging (std::string logPath)
 Initializes and sets the Log file path. More...
 
void Log (const char *source, const char *fmt,...)
 Logs a message to file. More...
 
void Error (const char *source, const char *fmt,...)
 Logs error message to console and file. More...
 
void Warning (const char *source, const char *fmt,...)
 Logs a warning message to file. More...
 
void White (const char *source, const char *fmt,...)
 Logs a message to console in white. More...
 
void Green (const char *source, const char *fmt,...)
 Logs a message to console in green. More...
 
void Blue (const char *source, const char *fmt,...)
 Logs a message to console in blue. More...
 
void Magenta (const char *source, const char *fmt,...)
 Logs a message to console in magenta. More...
 
void Yellow (const char *source, const char *fmt,...)
 Logs a message to console in yellow. More...
 
void Cyan (const char *source, const char *fmt,...)
 Logs a message to console in cyan. More...
 
void Debug (const char *source, const char *fmt,...)
 Logs a debug message to file and console. More...
 
bool SetLogfile (const char *filename)
 Sets the logfile to be used. More...
 
bool SetLogfile (FILE *file)
 Sets the logfile to be used. More...
 
void SetTime (time_t time)
 Sets the log system time every main loop. More...
 
- Public Member Functions inherited from Singleton< NewLog >
 Singleton ()
 Primary constructor. More...
 

Protected Types

enum  Color {
  COLOR_DEFAULT, COLOR_BLACK, COLOR_RED, COLOR_GREEN,
  COLOR_YELLOW, COLOR_BLUE, COLOR_MAGENTA, COLOR_CYAN,
  COLOR_WHITE, COLOR_COUNT
}
 A convenience color enum. More...
 

Protected Member Functions

void PrintMsg (Color color, char pfx, const char *source, const char *fmt, va_list ap)
 Prints a message. More...
 
void PrintTime ()
 Prints current time. More...
 
void Print (const char *fmt,...)
 Prints a raw message. More...
 
void PrintVa (const char *fmt, va_list ap)
 Prints a raw message. More...
 
void SetColor (Color color)
 Sets the color of the output text. More...
 
void SetLogfileDefault (std::string logPath)
 Sets the default logfile. More...
 

Protected Attributes

FILE * mLogfile
 The active logfile. More...
 
time_t mTime
 Current timestamp. More...
 
Mutex mMutex
 Protection against concurrent log messages. More...
 
bool m_initialized
 

Static Protected Attributes

static const char *const COLOR_TABLE [COLOR_COUNT]
 Color translation table. More...
 
- Static Protected Attributes inherited from Singleton< NewLog >
static std::shared_ptr< NewLogmInstance
 

Additional Inherited Members

- Static Public Member Functions inherited from Singleton< NewLog >
static NewLogget ()
 

Detailed Description

a small and simple logging system.

This class is designed to be a simple logging system that both logs to file and console regarding the settings.

Author
Captnoord.
Date
August 2009

Definition at line 41 of file LogNew.h.

Member Enumeration Documentation

enum NewLog::Color
protected

A convenience color enum.

Enumerator
COLOR_DEFAULT 

A default color.

COLOR_BLACK 

Black color.

COLOR_RED 

Red color.

COLOR_GREEN 

Green color.

COLOR_YELLOW 

Yellow color.

COLOR_BLUE 

Blue color.

COLOR_MAGENTA 

Magenta color.

COLOR_CYAN 

Cyan color.

COLOR_WHITE 

White color.

COLOR_COUNT 

Number of colors.

Definition at line 162 of file LogNew.h.

163  {
164  COLOR_DEFAULT,
165  COLOR_BLACK,
166  COLOR_RED,
167  COLOR_GREEN,
168  COLOR_YELLOW,
169  COLOR_BLUE,
170  COLOR_MAGENTA,
171  COLOR_CYAN,
172  COLOR_WHITE,
173 
174  COLOR_COUNT
175  };
Magenta color.
Definition: LogNew.h:170
Red color.
Definition: LogNew.h:166
A default color.
Definition: LogNew.h:164
Green color.
Definition: LogNew.h:167
Yellow color.
Definition: LogNew.h:168
Cyan color.
Definition: LogNew.h:171
Number of colors.
Definition: LogNew.h:174
Black color.
Definition: LogNew.h:165
Blue color.
Definition: LogNew.h:169
White color.
Definition: LogNew.h:172

Constructor & Destructor Documentation

NewLog::NewLog ( )

Primary constructor, initializes logging.

Definition at line 48 of file LogNew.cpp.

References m_initialized, and SetLogfileDefault().

49 : mLogfile( NULL ),
50  mTime( 0 ),
51  m_initialized(false)
52 {
53  // open default logfile
54  std::string logPath = EVEMU_ROOT "/logs/";
55  SetLogfileDefault(logPath);
56 
57  m_initialized = true;
58 }
FILE * mLogfile
The active logfile.
Definition: LogNew.h:227
void SetLogfileDefault(std::string logPath)
Sets the default logfile.
Definition: LogNew.cpp:315
time_t mTime
Current timestamp.
Definition: LogNew.h:229
bool m_initialized
Definition: LogNew.h:233

Here is the call graph for this function:

NewLog::NewLog ( std::string  logPath)

Definition at line 60 of file LogNew.cpp.

References m_initialized, and SetLogfileDefault().

61 : mLogfile( NULL ),
62 mTime( 0 )
63 {
64  // open default logfile
65  if( logPath.empty() )
66  logPath = EVEMU_ROOT "/logs/";
67 
68  SetLogfileDefault(logPath);
69 
70  m_initialized = true;
71 }
FILE * mLogfile
The active logfile.
Definition: LogNew.h:227
void SetLogfileDefault(std::string logPath)
Sets the default logfile.
Definition: LogNew.cpp:315
time_t mTime
Current timestamp.
Definition: LogNew.h:229
bool m_initialized
Definition: LogNew.h:233

Here is the call graph for this function:

NewLog::~NewLog ( )

Destructor, closes the logfile.

Definition at line 74 of file LogNew.cpp.

References Debug(), and SetLogfile().

75 {
76  Debug( "Log", "Log system shutting down" );
77 
78  // close logfile
79  SetLogfile( (FILE*)NULL );
80 }
void Debug(const char *source, const char *fmt,...)
Logs a debug message to file and console.
Definition: LogNew.cpp:191
bool SetLogfile(const char *filename)
Sets the logfile to be used.
Definition: LogNew.cpp:203

Here is the call graph for this function:

Member Function Documentation

void NewLog::Blue ( const char *  source,
const char *  fmt,
  ... 
)

Logs a message to console in blue.

Parameters
[in]sourceis the source from where the message is printed.
[in]fmtis the message itself.

Definition at line 161 of file LogNew.cpp.

References COLOR_BLUE, and PrintMsg().

Referenced by Initialize().

162 {
163  va_list ap;
164  va_start( ap, fmt );
165 
166  PrintMsg( COLOR_BLUE, 'B', source, fmt, ap );
167 
168  va_end( ap );
169 }
Blue color.
Definition: LogNew.h:169
void PrintMsg(Color color, char pfx, const char *source, const char *fmt, va_list ap)
Prints a message.
Definition: LogNew.cpp:230

Here is the call graph for this function:

Here is the caller graph for this function:

void NewLog::Cyan ( const char *  source,
const char *  fmt,
  ... 
)

Logs a message to console in cyan.

Parameters
[in]sourceis the source from where the message is printed.
[in]fmtis the message itself.

Definition at line 141 of file LogNew.cpp.

References COLOR_CYAN, and PrintMsg().

142 {
143  va_list ap;
144  va_start( ap, fmt );
145 
146  PrintMsg( COLOR_CYAN, 'C', source, fmt, ap );
147 
148  va_end( ap );
149 }
Cyan color.
Definition: LogNew.h:171
void PrintMsg(Color color, char pfx, const char *source, const char *fmt, va_list ap)
Prints a message.
Definition: LogNew.cpp:230

Here is the call graph for this function:

void NewLog::Debug ( const char *  source,
const char *  fmt,
  ... 
)

Logs a debug message to file and console.

Optimized out on a release build.

Parameters
[in]sourceis the source from where the message is printed.
[in]fmtis the message itself.

Definition at line 191 of file LogNew.cpp.

References COLOR_WHITE, is_log_enabled, and PrintMsg().

Referenced by ~NewLog().

192 {
193  if (!is_log_enabled(DEBUG__DEBUG))
194  return;
195  va_list ap;
196  va_start( ap, fmt );
197 
198  PrintMsg( COLOR_WHITE, 'D', source, fmt, ap );
199 
200  va_end( ap );
201 }
#define is_log_enabled(type)
Definition: logsys.h:78
White color.
Definition: LogNew.h:172
void PrintMsg(Color color, char pfx, const char *source, const char *fmt, va_list ap)
Prints a message.
Definition: LogNew.cpp:230

Here is the call graph for this function:

Here is the caller graph for this function:

void NewLog::Error ( const char *  source,
const char *  fmt,
  ... 
)

Logs error message to console and file.

Parameters
[in]sourceis the source from where the message is printed.
[in]fmtis the error message itself.

Definition at line 121 of file LogNew.cpp.

References COLOR_RED, and PrintMsg().

122 {
123  va_list ap;
124  va_start( ap, fmt );
125 
126  PrintMsg( COLOR_RED, 'E', source, fmt, ap );
127 
128  va_end( ap );
129 }
Red color.
Definition: LogNew.h:166
void PrintMsg(Color color, char pfx, const char *source, const char *fmt, va_list ap)
Prints a message.
Definition: LogNew.cpp:230

Here is the call graph for this function:

void NewLog::Green ( const char *  source,
const char *  fmt,
  ... 
)

Logs a message to console in green.

Parameters
[in]sourceis the source from where the message is printed.
[in]fmtis the message itself.

Definition at line 151 of file LogNew.cpp.

References COLOR_GREEN, and PrintMsg().

152 {
153  va_list ap;
154  va_start( ap, fmt );
155 
156  PrintMsg( COLOR_GREEN, 'G', source, fmt, ap );
157 
158  va_end( ap );
159 }
Green color.
Definition: LogNew.h:167
void PrintMsg(Color color, char pfx, const char *source, const char *fmt, va_list ap)
Prints a message.
Definition: LogNew.cpp:230

Here is the call graph for this function:

void NewLog::Initialize ( )

Definition at line 82 of file LogNew.cpp.

References Blue().

83 {
84  Blue(" Log System", "Log System Initialized.");
85 }
void Blue(const char *source, const char *fmt,...)
Logs a message to console in blue.
Definition: LogNew.cpp:161

Here is the call graph for this function:

void NewLog::InitializeLogging ( std::string  logPath)

Initializes and sets the Log file path.

Parameters
[in]logPathis the absolute or relative path where log files are to be stored

Definition at line 88 of file LogNew.cpp.

References m_initialized, and SetLogfileDefault().

89 {
90  // open default logfile
91  if( logPath.empty() )
92  logPath = EVEMU_ROOT "/logs/";
93 
94  m_initialized = true;
95 
96  SetLogfileDefault(logPath);
97 }
void SetLogfileDefault(std::string logPath)
Sets the default logfile.
Definition: LogNew.cpp:315
bool m_initialized
Definition: LogNew.h:233

Here is the call graph for this function:

void NewLog::Log ( const char *  source,
const char *  fmt,
  ... 
)

Logs a message to file.

Parameters
[in]sourceis the source from where the message is printed.
[in]fmtis the message itself.

Definition at line 99 of file LogNew.cpp.

References COLOR_DEFAULT, and PrintMsg().

100 {
101  va_list ap;
102  va_start( ap, fmt );
103 
104  PrintMsg( COLOR_DEFAULT, 'L', source, fmt, ap );
105 
106  va_end( ap );
107 }
A default color.
Definition: LogNew.h:164
void PrintMsg(Color color, char pfx, const char *source, const char *fmt, va_list ap)
Prints a message.
Definition: LogNew.cpp:230

Here is the call graph for this function:

void NewLog::Magenta ( const char *  source,
const char *  fmt,
  ... 
)

Logs a message to console in magenta.

Parameters
[in]sourceis the source from where the message is printed.
[in]fmtis the message itself.

Definition at line 171 of file LogNew.cpp.

References COLOR_MAGENTA, and PrintMsg().

172 {
173  va_list ap;
174  va_start( ap, fmt );
175 
176  PrintMsg( COLOR_MAGENTA, 'M', source, fmt, ap );
177 
178  va_end( ap );
179 }
Magenta color.
Definition: LogNew.h:170
void PrintMsg(Color color, char pfx, const char *source, const char *fmt, va_list ap)
Prints a message.
Definition: LogNew.cpp:230

Here is the call graph for this function:

void NewLog::Print ( const char *  fmt,
  ... 
)
protected

Prints a raw message.

This method only handles printing to all desired destinations (standard output and logfile at the moment).

Parameters
[in]fmtThe format string.
[in]...The arguments.

Definition at line 269 of file LogNew.cpp.

References PrintVa().

Referenced by PrintMsg(), and PrintTime().

270 {
271  va_list ap;
272  va_start( ap, fmt );
273 
274  PrintVa( fmt, ap );
275 
276  va_end( ap );
277 }
void PrintVa(const char *fmt, va_list ap)
Prints a raw message.
Definition: LogNew.cpp:279

Here is the call graph for this function:

Here is the caller graph for this function:

void NewLog::PrintMsg ( Color  color,
char  pfx,
const char *  source,
const char *  fmt,
va_list  ap 
)
protected

Prints a message.

This prints a generic message.

Parameters
[in]colorColor of the message.
[in]pfxSingle-character prefix/identificator.
[in]sourceOrigin of message.
[in]fmtThe format string.
[in]apThe arguments.

Definition at line 230 of file LogNew.cpp.

References COLOR_DEFAULT, COLOR_WHITE, m_initialized, mMutex, Print(), PrintTime(), PrintVa(), and SetColor().

Referenced by Blue(), Cyan(), Debug(), Error(), Green(), Log(), Magenta(), Warning(), White(), and Yellow().

231 {
232  if( !m_initialized )
233  return;
234 
235  MutexLock l( mMutex );
236 
237  PrintTime();
238 
239  SetColor( color );
240  Print( " %c ", pfx );
241 
242  if( source && *source )
243  {
245  Print( "%s: ", source );
246 
247  SetColor( color );
248  }
249 
250  PrintVa( fmt, ap );
251  Print( "\n" );
252 
254 }
void PrintTime()
Prints current time.
Definition: LogNew.cpp:256
void SetColor(Color color)
Sets the color of the output text.
Definition: LogNew.cpp:302
A default color.
Definition: LogNew.h:164
A lock for a Lockable object.
Definition: Lock.h:70
Mutex mMutex
Protection against concurrent log messages.
Definition: LogNew.h:231
bool m_initialized
Definition: LogNew.h:233
White color.
Definition: LogNew.h:172
void PrintVa(const char *fmt, va_list ap)
Prints a raw message.
Definition: LogNew.cpp:279
void Print(const char *fmt,...)
Prints a raw message.
Definition: LogNew.cpp:269

Here is the call graph for this function:

Here is the caller graph for this function:

void NewLog::PrintTime ( )
protected

Prints current time.

Definition at line 256 of file LogNew.cpp.

References localtime_r(), mMutex, mTime, Print(), and SetTime().

Referenced by PrintMsg().

257 {
258  MutexLock l( mMutex );
259 
260  // this will be replaced my a timing thread somehow
261  SetTime( time( NULL ) );
262 
263  tm t;
264  localtime_r( &mTime, &t );
265 
266  Print( "%02u:%02u:%02u", t.tm_hour, t.tm_min, t.tm_sec );
267 }
tm * localtime_r(const time_t *timep, tm *result)
Definition: eve-compat.cpp:184
A lock for a Lockable object.
Definition: Lock.h:70
Mutex mMutex
Protection against concurrent log messages.
Definition: LogNew.h:231
time_t mTime
Current timestamp.
Definition: LogNew.h:229
void SetTime(time_t time)
Sets the log system time every main loop.
Definition: LogNew.h:158
void Print(const char *fmt,...)
Prints a raw message.
Definition: LogNew.cpp:269

Here is the call graph for this function:

Here is the caller graph for this function:

void NewLog::PrintVa ( const char *  fmt,
va_list  ap 
)
protected

Prints a raw message.

This method only handles printing to all desired destinations (standard output and logfile at the moment).

Parameters
[in]fmtThe format string.
[in]apThe arguments.

Definition at line 279 of file LogNew.cpp.

References mLogfile, mMutex, and va_copy.

Referenced by Print(), and PrintMsg().

280 {
281  MutexLock l( mMutex );
282 
283  if( NULL != mLogfile )
284  {
285  // this is a design flaw ( UNIX related )
286  va_list ap2;
287  va_copy( ap2, ap );
288 
289  vfprintf( mLogfile, fmt, ap2 );
290 
291 #ifndef NDEBUG
292  // flush immediately so logfile is accurate if we crash
293  fflush( mLogfile );
294 #endif /* !NDEBUG */
295 
296  va_end( ap2 );
297  }
298 
299  vprintf( fmt, ap );
300 }
A lock for a Lockable object.
Definition: Lock.h:70
#define va_copy(a, b)
Definition: eve-compat.h:177
Mutex mMutex
Protection against concurrent log messages.
Definition: LogNew.h:231
FILE * mLogfile
The active logfile.
Definition: LogNew.h:227

Here is the caller graph for this function:

void NewLog::SetColor ( Color  color)
protected

Sets the color of the output text.

Parameters
[in]colorThe new color of output text.

Definition at line 302 of file LogNew.cpp.

References COLOR_COUNT, COLOR_TABLE, and mMutex.

Referenced by PrintMsg().

303 {
304  assert( 0 <= color && color < COLOR_COUNT );
305 
306  MutexLock l( mMutex );
307 
308 #ifdef HAVE_WINDOWS_H
309  ::SetConsoleTextAttribute( mStdOutHandle, COLOR_TABLE[ color ] );
310 #else /* !HAVE_WINDOWS_H */
311  ::fputs( COLOR_TABLE[ color ], stdout );
312 #endif /* !HAVE_WINDOWS_H */
313 }
A lock for a Lockable object.
Definition: Lock.h:70
Mutex mMutex
Protection against concurrent log messages.
Definition: LogNew.h:231
static const char *const COLOR_TABLE[COLOR_COUNT]
Color translation table.
Definition: LogNew.h:245
Number of colors.
Definition: LogNew.h:174

Here is the caller graph for this function:

bool NewLog::SetLogfile ( const char *  filename)

Sets the logfile to be used.

Parameters
[in]filenameA name of file.
Return values
trueThe new logfile was successfully opened.
falseFailed to open the new logfile.

Definition at line 203 of file LogNew.cpp.

References mMutex.

Referenced by SetLogfileDefault(), and ~NewLog().

204 {
205  MutexLock l( mMutex );
206 
207  FILE* file = NULL;
208 
209  if( NULL != filename )
210  {
211  file = fopen( filename, "w" );
212  if( NULL == file )
213  return false;
214  }
215 
216  return SetLogfile( file );
217 }
A lock for a Lockable object.
Definition: Lock.h:70
Mutex mMutex
Protection against concurrent log messages.
Definition: LogNew.h:231
bool SetLogfile(const char *filename)
Sets the logfile to be used.
Definition: LogNew.cpp:203

Here is the caller graph for this function:

bool NewLog::SetLogfile ( FILE *  file)

Sets the logfile to be used.

Passed file is closed during destruction.

Parameters
[in]fileA handle to file.
Return values
trueThe new logfile was successfully opened.
falseFailed to open the new logfile.

Definition at line 219 of file LogNew.cpp.

References mLogfile, and mMutex.

220 {
221  MutexLock l( mMutex );
222 
223  if( NULL != mLogfile )
224  assert( 0 == fclose( mLogfile ) );
225 
226  mLogfile = file;
227  return true;
228 }
A lock for a Lockable object.
Definition: Lock.h:70
Mutex mMutex
Protection against concurrent log messages.
Definition: LogNew.h:231
FILE * mLogfile
The active logfile.
Definition: LogNew.h:227
void NewLog::SetLogfileDefault ( std::string  logPath)
protected

Sets the default logfile.

Definition at line 315 of file LogNew.cpp.

References localtime_r(), mMutex, mTime, SetLogfile(), SetTime(), snprintf, and Warning().

Referenced by InitializeLogging(), and NewLog().

316 {
317  MutexLock l( mMutex );
318 
319  // set initial log system time
320  SetTime( time( NULL ) );
321 
322  tm t;
323  localtime_r( &mTime, &t );
324 
325  // open default logfile
326  char filename[ FILENAME_MAX + 1 ];
327  std::string logFile = logPath + "%02u-%02u-%04u-%02u-%02u.log";
328  snprintf( filename, FILENAME_MAX + 1, logFile.c_str(),
329  t.tm_mday, t.tm_mon + 1, t.tm_year + 1900, t.tm_hour, t.tm_min );
330  //snprintf( filename, FILENAME_MAX + 1, EVEMU_ROOT "/logs/%02u-%02u-%04u-%02u-%02u.log",
331  // t.tm_mday, t.tm_mon + 1, t.tm_year + 1900, t.tm_hour, t.tm_min );
332 
333  // this isnt accurate as log system is not initalized yet. all Print calls will fail
334  if (!SetLogfile(filename))
335  Warning( "Log", "Unable to open logfile '%s': %s", filename, strerror( errno ) );
336 }
tm * localtime_r(const time_t *timep, tm *result)
Definition: eve-compat.cpp:184
A lock for a Lockable object.
Definition: Lock.h:70
Mutex mMutex
Protection against concurrent log messages.
Definition: LogNew.h:231
time_t mTime
Current timestamp.
Definition: LogNew.h:229
#define snprintf
Definition: eve-compat.h:184
bool SetLogfile(const char *filename)
Sets the logfile to be used.
Definition: LogNew.cpp:203
void SetTime(time_t time)
Sets the log system time every main loop.
Definition: LogNew.h:158
void Warning(const char *source, const char *fmt,...)
Logs a warning message to file.
Definition: LogNew.cpp:131

Here is the call graph for this function:

Here is the caller graph for this function:

void NewLog::SetTime ( time_t  time)
inline

Sets the log system time every main loop.

Parameters
[in]timeis the timestamp.

Definition at line 158 of file LogNew.h.

References mTime.

Referenced by PrintTime(), and SetLogfileDefault().

158 { mTime = time; }
time_t mTime
Current timestamp.
Definition: LogNew.h:229

Here is the caller graph for this function:

void NewLog::Warning ( const char *  source,
const char *  fmt,
  ... 
)

Logs a warning message to file.

Parameters
[in]sourceis the source from where the message is printed.
[in]fmtis the message itself.

Definition at line 131 of file LogNew.cpp.

References COLOR_YELLOW, and PrintMsg().

Referenced by SetLogfileDefault().

132 {
133  va_list ap;
134  va_start( ap, fmt );
135 
136  PrintMsg( COLOR_YELLOW, 'W', source, fmt, ap );
137 
138  va_end( ap );
139 }
Yellow color.
Definition: LogNew.h:168
void PrintMsg(Color color, char pfx, const char *source, const char *fmt, va_list ap)
Prints a message.
Definition: LogNew.cpp:230

Here is the call graph for this function:

Here is the caller graph for this function:

void NewLog::White ( const char *  source,
const char *  fmt,
  ... 
)

Logs a message to console in white.

Parameters
[in]sourceis the source from where the message is printed.
[in]fmtis the message itself.

Definition at line 109 of file LogNew.cpp.

References COLOR_WHITE, is_log_enabled, and PrintMsg().

110 {
111  if (!is_log_enabled(DEBUG__DEV_LOG))
112  return;
113  va_list ap;
114  va_start( ap, fmt );
115 
116  PrintMsg( COLOR_WHITE, 'W', source, fmt, ap );
117 
118  va_end( ap );
119 }
#define is_log_enabled(type)
Definition: logsys.h:78
White color.
Definition: LogNew.h:172
void PrintMsg(Color color, char pfx, const char *source, const char *fmt, va_list ap)
Prints a message.
Definition: LogNew.cpp:230

Here is the call graph for this function:

void NewLog::Yellow ( const char *  source,
const char *  fmt,
  ... 
)

Logs a message to console in yellow.

Parameters
[in]sourceis the source from where the message is printed.
[in]fmtis the message itself.

Definition at line 181 of file LogNew.cpp.

References COLOR_YELLOW, and PrintMsg().

182 {
183  va_list ap;
184  va_start( ap, fmt );
185 
186  PrintMsg( COLOR_YELLOW, 'Y', source, fmt, ap );
187 
188  va_end( ap );
189 }
Yellow color.
Definition: LogNew.h:168
void PrintMsg(Color color, char pfx, const char *source, const char *fmt, va_list ap)
Prints a message.
Definition: LogNew.cpp:230

Here is the call graph for this function:

Member Data Documentation

const char *const NewLog::COLOR_TABLE
staticprotected
Initial value:
=
{
"\033[" "00" "m",
"\033[" "30;22" "m",
"\033[" "31;22" "m",
"\033[" "32;22" "m",
"\033[" "33;01" "m",
"\033[" "34;01" "m",
"\033[" "35;22" "m",
"\033[" "36;01" "m",
"\033[" "37;01" "m"
}

Color translation table.

Definition at line 245 of file LogNew.h.

Referenced by SetColor().

bool NewLog::m_initialized
protected

Definition at line 233 of file LogNew.h.

Referenced by InitializeLogging(), NewLog(), and PrintMsg().

FILE* NewLog::mLogfile
protected

The active logfile.

Definition at line 227 of file LogNew.h.

Referenced by PrintVa(), and SetLogfile().

Mutex NewLog::mMutex
protected

Protection against concurrent log messages.

Definition at line 231 of file LogNew.h.

Referenced by PrintMsg(), PrintTime(), PrintVa(), SetColor(), SetLogfile(), and SetLogfileDefault().

time_t NewLog::mTime
protected

Current timestamp.

Definition at line 229 of file LogNew.h.

Referenced by PrintTime(), SetLogfileDefault(), and SetTime().


The documentation for this class was generated from the following files: