56 static const char *priority_name[] = {
68 std::lock_guard<std::mutex> lock(mutex);
70 fprintf(
m_file,
"%s %s : %s\n", priority_name[priority],
m_name.c_str(),
75 fprintf(
m_file,
"%u %s %s : %s\n", (
unsigned)t, priority_name[priority],
83 char buffer[1024 * 16];
84 vsnprintf(buffer,
sizeof(buffer), format, ap);
void log_string(int priority, const char *message)
Appends a string message to the log.
void initialize(const String &name)
Public initialization function - creates a singleton instance of LogWriter.
std::string String
A String is simply a typedef to std::string.
String format(const char *fmt,...)
Returns a String using printf like format facilities Vanilla snprintf is about 1.5x faster than this...
void debug(const char *format,...)
Prints a debug message with variable arguments (similar to printf)
void log_varargs(int priority, const char *format, va_list ap)
Appends a string message with variable arguments to the log.
String m_name
The name of the application.
Logging routines and macros.
Compatibility Macros for C/C++.
void flush()
Flushes the log file.
static String logger_name
FILE * m_file
The output file handle.
The LogWriter class writes to stdout.
void log(int priority, const char *format,...)
Prints a message with variable arguments.
A String class based on std::string.
static LogWriter * logger_obj
bool m_test_mode
True if this log is in test mode.