PLog.h File Reference

Detailed Description

The log system.

Definition in file PLog.h.

#include <PapillonCommon.h>
#include <PString.h>
#include <PStringConstants.h>
Include dependency graph for PLog.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

class  PLog
 The PLog class represents the log system (singleton) used by Papillon; thread-safe. More...
 
class  PLogStream
 The PLogStream class represents a log stream used by log macros (should not be used directly, see P_LOG_INFO and related). More...
 

Macros

#define P_LOG(level)   papillon::PLogStream(level, papillon::C_LOG_PREFIX, PAPILLON_SRC_POS)
 Logs a message with the specified log level. More...
 
#define P_LOG_DEBUG   papillon::PLogStream(papillon::PLog::E_LEVEL_DEBUG, papillon::PLog::GetPrefix(), PAPILLON_SRC_POS)
 Logs the specified message with DEBUG level. More...
 
#define P_LOG_ERROR   papillon::PLogStream(papillon::PLog::E_LEVEL_ERROR, papillon::PLog::GetPrefix(), PAPILLON_SRC_POS)
 Logs the specified message with ERROR level. More...
 
#define P_LOG_FATAL   papillon::PLogStream(papillon::PLog::E_LEVEL_FATAL, papillon::PLog::GetPrefix(), PAPILLON_SRC_POS)
 Logs the specified message with FATAL level. More...
 
#define P_LOG_INFO   papillon::PLogStream(papillon::PLog::E_LEVEL_INFO, papillon::PLog::GetPrefix(), PAPILLON_SRC_POS)
 Logs the specified message with INFO level. More...
 
#define P_LOG_SKIP_LINE   papillon::PLog::Log(papillon::PLog::E_LEVEL_INFO, "\n");
 Writes a blank line in the log. More...
 
#define P_LOG_TRACE   papillon::PLogStream(papillon::PLog::E_LEVEL_TRACE, papillon::PLog::GetPrefix(), PAPILLON_SRC_POS)
 Logs the specified message with TRACE level. More...
 
#define P_LOG_WARNING   papillon::PLogStream(papillon::PLog::E_LEVEL_WARNING, papillon::PLog::GetPrefix(), PAPILLON_SRC_POS)
 Logs the specified message with WARNING level. More...
 

Functions

const PLogStreamoperator<< (const PLogStream &os, void *ptr)
 
const PLogStreamoperator<< (const PLogStream &os, const char *val)
 
const PLogStreamoperator<< (const PLogStream &os, const wchar_t *val)
 
const PLogStreamoperator<< (const PLogStream &os, const std::string &val)
 
const PLogStreamoperator<< (const PLogStream &os, bool val)
 
const PLogStreamoperator<< (const PLogStream &os, double val)
 
const PLogStreamoperator<< (const PLogStream &os, float val)
 
const PLogStreamoperator<< (const PLogStream &os, char val)
 
const PLogStreamoperator<< (const PLogStream &os, int8 val)
 
const PLogStreamoperator<< (const PLogStream &os, uint8 val)
 
const PLogStreamoperator<< (const PLogStream &os, int16 val)
 
const PLogStreamoperator<< (const PLogStream &os, uint16 val)
 
const PLogStreamoperator<< (const PLogStream &os, int32 val)
 
const PLogStreamoperator<< (const PLogStream &os, uint32 val)
 
const PLogStreamoperator<< (const PLogStream &os, int64 val)
 
const PLogStreamoperator<< (const PLogStream &os, uint64 val)
 
template<class T >
const PLogStreamoperator<< (const PLogStream &os, const T &obj)
 

Variables

PAPILLON_BEGIN_NAMESPACE typedef void(* PCallback_Logger )(const PString &logMessage)
 Callback to be notified each time there is a new log message. More...
 

Macro Definition Documentation

◆ P_LOG

#define P_LOG (   level)    papillon::PLogStream(level, papillon::C_LOG_PREFIX, PAPILLON_SRC_POS)

Logs a message with the specified log level.

Definition at line 326 of file PLog.h.

◆ P_LOG_DEBUG

#define P_LOG_DEBUG   papillon::PLogStream(papillon::PLog::E_LEVEL_DEBUG, papillon::PLog::GetPrefix(), PAPILLON_SRC_POS)

Logs the specified message with DEBUG level.

Definition at line 341 of file PLog.h.

◆ P_LOG_ERROR

#define P_LOG_ERROR   papillon::PLogStream(papillon::PLog::E_LEVEL_ERROR, papillon::PLog::GetPrefix(), PAPILLON_SRC_POS)

Logs the specified message with ERROR level.

Definition at line 356 of file PLog.h.

◆ P_LOG_FATAL

#define P_LOG_FATAL   papillon::PLogStream(papillon::PLog::E_LEVEL_FATAL, papillon::PLog::GetPrefix(), PAPILLON_SRC_POS)

Logs the specified message with FATAL level.

Definition at line 361 of file PLog.h.

◆ P_LOG_INFO

#define P_LOG_INFO   papillon::PLogStream(papillon::PLog::E_LEVEL_INFO, papillon::PLog::GetPrefix(), PAPILLON_SRC_POS)

Logs the specified message with INFO level.

Definition at line 346 of file PLog.h.

◆ P_LOG_SKIP_LINE

#define P_LOG_SKIP_LINE   papillon::PLog::Log(papillon::PLog::E_LEVEL_INFO, "\n");

Writes a blank line in the log.

Definition at line 331 of file PLog.h.

◆ P_LOG_TRACE

#define P_LOG_TRACE   papillon::PLogStream(papillon::PLog::E_LEVEL_TRACE, papillon::PLog::GetPrefix(), PAPILLON_SRC_POS)

Logs the specified message with TRACE level.

Definition at line 336 of file PLog.h.

◆ P_LOG_WARNING

#define P_LOG_WARNING   papillon::PLogStream(papillon::PLog::E_LEVEL_WARNING, papillon::PLog::GetPrefix(), PAPILLON_SRC_POS)

Logs the specified message with WARNING level.

Definition at line 351 of file PLog.h.

Function Documentation

◆ operator<<() [1/17]

const PLogStream& operator<< ( const PLogStream os,
void *  ptr 
)
inline

Definition at line 279 of file PLog.h.

◆ operator<<() [2/17]

const PLogStream& operator<< ( const PLogStream os,
const char *  val 
)
inline

Definition at line 280 of file PLog.h.

◆ operator<<() [3/17]

const PLogStream& operator<< ( const PLogStream os,
const wchar_t *  val 
)
inline

Definition at line 281 of file PLog.h.

◆ operator<<() [4/17]

const PLogStream& operator<< ( const PLogStream os,
const std::string &  val 
)
inline

Definition at line 282 of file PLog.h.

◆ operator<<() [5/17]

const PLogStream& operator<< ( const PLogStream os,
bool  val 
)
inline

Definition at line 283 of file PLog.h.

◆ operator<<() [6/17]

const PLogStream& operator<< ( const PLogStream os,
double  val 
)
inline

Definition at line 284 of file PLog.h.

◆ operator<<() [7/17]

const PLogStream& operator<< ( const PLogStream os,
float  val 
)
inline

Definition at line 285 of file PLog.h.

◆ operator<<() [8/17]

const PLogStream& operator<< ( const PLogStream os,
char  val 
)
inline

Definition at line 286 of file PLog.h.

◆ operator<<() [9/17]

const PLogStream& operator<< ( const PLogStream os,
int8  val 
)
inline

Definition at line 287 of file PLog.h.

◆ operator<<() [10/17]

const PLogStream& operator<< ( const PLogStream os,
uint8  val 
)
inline

Definition at line 288 of file PLog.h.

◆ operator<<() [11/17]

const PLogStream& operator<< ( const PLogStream os,
int16  val 
)
inline

Definition at line 289 of file PLog.h.

◆ operator<<() [12/17]

const PLogStream& operator<< ( const PLogStream os,
uint16  val 
)
inline

Definition at line 290 of file PLog.h.

◆ operator<<() [13/17]

const PLogStream& operator<< ( const PLogStream os,
int32  val 
)
inline

Definition at line 291 of file PLog.h.

◆ operator<<() [14/17]

const PLogStream& operator<< ( const PLogStream os,
uint32  val 
)
inline

Definition at line 292 of file PLog.h.

◆ operator<<() [15/17]

const PLogStream& operator<< ( const PLogStream os,
int64  val 
)
inline

Definition at line 293 of file PLog.h.

◆ operator<<() [16/17]

const PLogStream& operator<< ( const PLogStream os,
uint64  val 
)
inline

Definition at line 294 of file PLog.h.

◆ operator<<() [17/17]

template<class T >
const PLogStream& operator<< ( const PLogStream os,
const T &  obj 
)

Definition at line 303 of file PLog.h.

Variable Documentation

◆ PCallback_Logger

PAPILLON_BEGIN_NAMESPACE typedef void(* PCallback_Logger) (const PString &logMessage)

Callback to be notified each time there is a new log message.

Messages are formatted before being passed to callback.

How to register a new callback?

Definition at line 32 of file PLog.h.