0.9.8.10
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
Public Member Functions | Private Member Functions | Private Attributes | List of all members
Hypertable::Logger::LogWriter Class Reference

The LogWriter class writes to stdout. More...

#include <Logger.h>

Collaboration diagram for Hypertable::Logger::LogWriter:
Collaboration graph
[legend]

Public Member Functions

 LogWriter (const String &name)
 Constructor. More...
 
void set_level (int level)
 Sets the message level; all messages with a higher level are discarded. More...
 
int get_level () const
 Returns the message level. More...
 
bool is_enabled (int level) const
 Returns true if a message with this level is not discarded. More...
 
void set_test_mode (int fd=-1)
 The test mode disables line numbers and timestamps and can redirect the output to a separate file descriptor. More...
 
bool show_line_numbers () const
 Returns true if line numbers are printed. More...
 
void flush ()
 Flushes the log file. More...
 
void debug (const char *format,...)
 Prints a debug message with variable arguments (similar to printf) More...
 
void debug (const String &message)
 Prints a debug message. More...
 
void log (int priority, const char *format,...)
 Prints a message with variable arguments. More...
 
void log (int priority, const String &message)
 Prints a message. More...
 

Private Member Functions

void log_string (int priority, const char *message)
 Appends a string message to the log. More...
 
void log_varargs (int priority, const char *format, va_list ap)
 Appends a string message with variable arguments to the log. More...
 

Private Attributes

bool m_show_line_numbers
 True if line numbers are shown. More...
 
bool m_test_mode
 True if this log is in test mode. More...
 
String m_name
 The name of the application. More...
 
int m_priority
 The current priority (everything above is filtered) More...
 
FILE * m_file
 The output file handle. More...
 

Detailed Description

The LogWriter class writes to stdout.

It's not used directly, but rather through the macros below (i.e. HT_ERROR_OUT, HT_ERRORF etc).

Definition at line 70 of file Logger.h.

Constructor & Destructor Documentation

Hypertable::Logger::LogWriter::LogWriter ( const String name)
inline

Constructor.

Parameters
nameThe name of the application

Definition at line 76 of file Logger.h.

Member Function Documentation

void Hypertable::Logger::LogWriter::debug ( const char *  format,
  ... 
)

Prints a debug message with variable arguments (similar to printf)

Definition at line 88 of file Logger.cc.

void Hypertable::Logger::LogWriter::debug ( const String message)
inline

Prints a debug message.

Definition at line 121 of file Logger.h.

void Hypertable::Logger::LogWriter::flush ( )
inline

Flushes the log file.

Definition at line 113 of file Logger.h.

int Hypertable::Logger::LogWriter::get_level ( ) const
inline

Returns the message level.

Definition at line 88 of file Logger.h.

bool Hypertable::Logger::LogWriter::is_enabled ( int  level) const
inline

Returns true if a message with this level is not discarded.

Definition at line 93 of file Logger.h.

void Hypertable::Logger::LogWriter::log ( int  priority,
const char *  format,
  ... 
)

Prints a message with variable arguments.

Definition at line 95 of file Logger.cc.

void Hypertable::Logger::LogWriter::log ( int  priority,
const String message 
)
inline

Prints a message.

Definition at line 129 of file Logger.h.

void Hypertable::Logger::LogWriter::log_string ( int  priority,
const char *  message 
)
private

Appends a string message to the log.

Definition at line 55 of file Logger.cc.

void Hypertable::Logger::LogWriter::log_varargs ( int  priority,
const char *  format,
va_list  ap 
)
private

Appends a string message with variable arguments to the log.

Definition at line 82 of file Logger.cc.

void Hypertable::Logger::LogWriter::set_level ( int  level)
inline

Sets the message level; all messages with a higher level are discarded.

Definition at line 83 of file Logger.h.

void Hypertable::Logger::LogWriter::set_test_mode ( int  fd = -1)
inline

The test mode disables line numbers and timestamps and can redirect the output to a separate file descriptor.

Definition at line 100 of file Logger.h.

bool Hypertable::Logger::LogWriter::show_line_numbers ( ) const
inline

Returns true if line numbers are printed.

Definition at line 108 of file Logger.h.

Member Data Documentation

FILE* Hypertable::Logger::LogWriter::m_file
private

The output file handle.

Definition at line 153 of file Logger.h.

String Hypertable::Logger::LogWriter::m_name
private

The name of the application.

Definition at line 147 of file Logger.h.

int Hypertable::Logger::LogWriter::m_priority
private

The current priority (everything above is filtered)

Definition at line 150 of file Logger.h.

bool Hypertable::Logger::LogWriter::m_show_line_numbers
private

True if line numbers are shown.

Definition at line 141 of file Logger.h.

bool Hypertable::Logger::LogWriter::m_test_mode
private

True if this log is in test mode.

Definition at line 144 of file Logger.h.


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