base-logging
Public Member Functions | Protected Member Functions | Friends | List of all members
base::logging::Logger Class Reference

Logger is a logger that allows priority based logging with minimal impact on performance and minimal configuration requirements. More...

#include <logging_printf_style.h>

Inheritance diagram for base::logging::Logger:
base::Singleton< Derived >

Public Member Functions

virtual ~Logger ()
 
void configure (Priority priority, FILE *outputStream)
 
void log (Priority priority, const char *function, const char *filename, int line, const char *name_space, const char *format,...) const
 
void logBuffer (Priority priority, const char *function, const char *file, int line, const char *name_space, const char *buffer) const
 
- Public Member Functions inherited from base::Singleton< Derived >
virtual ~Singleton ()
 

Protected Member Functions

 Logger ()
 
- Protected Member Functions inherited from base::Singleton< Derived >
 Singleton ()
 

Friends

class Singleton< Logger >
 

Additional Inherited Members

- Static Public Member Functions inherited from base::Singleton< Derived >
static Derived * getInstance ()
 

Detailed Description

Logger is a logger that allows priority based logging with minimal impact on performance and minimal configuration requirements.

Use the environment variable BASE_LOG_LEVEL to define the requested logging level, e.g.:

1 export BASE_LOG_LEVEL="WARN"

A library designer can decide using the BASE_LOG_xxx flag at compile time which log level should be available.

So switch the output stream (for example logging into a file) the following can be used:

 BASE_LOG_CONFIGURE(priority,ostream)

Constructor & Destructor Documentation

base::logging::Logger::Logger ( )
protected

Construct the logger

base::logging::Logger::~Logger ( )
virtual

Member Function Documentation

void base::logging::Logger::configure ( Priority  priority,
FILE *  outputStream 
)

Configure logger - this is for the library developer so he can set a maximum log level, which cannot be further limited to higher log priorities via setting BASE_LOG_LEVEL.

If no previous configuration is given, no output logging will be done

void base::logging::Logger::log ( Priority  priority,
const char *  function,
const char *  filename,
int  line,
const char *  name_space,
const char *  format,
  ... 
) const

Logs a message with a given priority, can be used with printf style format

Parameters
prioritypriority level
nsnamespace to be used
filenameFilename
lineLinenumber
formatprintf like format string
...variable argument list
void base::logging::Logger::logBuffer ( Priority  priority,
const char *  function,
const char *  file,
int  line,
const char *  name_space,
const char *  buffer 
) const

used by log(...) logs the text contained in buffer.

Friends And Related Function Documentation

friend class Singleton< Logger >
friend

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