PVLogger Class Reference

#include <pvlogger.h>

Public Types

typedef int32 log_level_type
typedef int32 message_id_type
typedef int32 filter_status_type
typedef _OsclBasicAllocator alloc_type

Public Member Functions

void SetLogLevel (log_level_type level)
OSCL_IMPORT_REF void SetLogLevelAndPropagate (log_level_type level)
log_level_type GetLogLevel ()
void DisableAppenderInheritance ()
void AddAppender (OsclSharedPtr< PVLoggerAppender > &appender)
void RemoveAppender (OsclSharedPtr< PVLoggerAppender > &appender)
void AddFilter (OsclSharedPtr< PVLoggerFilter > &filter)
uint32 GetNumAppenders ()
OSCL_IMPORT_REF bool IsActive (log_level_type level)
OSCL_IMPORT_REF void LogMsgStringV (message_id_type msgID, const char *fmt, va_list arguments)
OSCL_IMPORT_REF void LogMsgBuffersV (message_id_type msgID, int32 numPairs, va_list arguments)
OSCL_IMPORT_REF void LogMsgString (message_id_type msgID, const char *fmt,...)
OSCL_IMPORT_REF void LogMsgBuffers (message_id_type msgID, int32 numPairs,...)
OSCL_IMPORT_REF PVLogger (const char *inputTag, log_level_type level, bool oAppenderInheritance)
virtual ~PVLogger ()

Static Public Member Functions

static OSCL_IMPORT_REF void Init ()
static OSCL_IMPORT_REF void Cleanup ()
static OSCL_IMPORT_REF PVLoggerGetLoggerObject (const char *inputTag)

Protected Member Functions

void SetParent (PVLogger *parentLogger)
PVLoggerGetParent ()

Friends

class PVLoggerRegistry

Member Typedef Documentation

typedef int32 PVLogger::log_level_type

Constructor & Destructor Documentation

OSCL_IMPORT_REF PVLogger::PVLogger ( const char *  inputTag,
log_level_type  level,
bool  oAppenderInheritance 
)

Logger Constructor

Parameters:
tag Logger tag, unique to a logging control point
level Active Log level of the logger
oAppenderInheritance 
Returns:
NONE
virtual PVLogger::~PVLogger (  )  [inline, virtual]

Member Function Documentation

void PVLogger::AddAppender ( OsclSharedPtr< PVLoggerAppender > &  appender  )  [inline]

This method adds an appender to the logging control point. Each logger maintains a list of appenders. Any msg to a logger if deemed active is logged to all the appenders.

Parameters:
appender pointer to the appender to add
Returns:
NONE
Exceptions:
leaves if out of memory

References OSCL_UNUSED_ARG, and Oscl_Vector< T, Alloc >::push_back().

void PVLogger::AddFilter ( OsclSharedPtr< PVLoggerFilter > &  filter  )  [inline]

This method adds a message filter to the logging control point. Each logger maintains a list of filters. Any msg to a logger if deemed active is passed through the msg filters prior to logging.

Parameters:
msgFilter pointer to the filter to add
Returns:
NONE
Exceptions:
leaves if out of memory

References OSCL_UNUSED_ARG, and Oscl_Vector< T, Alloc >::push_back().

static OSCL_IMPORT_REF void PVLogger::Cleanup (  )  [static]

Frees the PVLogger singleton used by the current thread. This must be called before thread exit. No messages can be logged after cleanup.

Returns:
void PVLogger::DisableAppenderInheritance (  )  [inline]

This method disables appender inheritance for the logging control point

static OSCL_IMPORT_REF PVLogger* PVLogger::GetLoggerObject ( const char *  inputTag  )  [static]

This is a factory method to create a log control point, with a certain input tag. There is a central registry of all the loggers, with their corresponding tags, called PV Logger Registry. In case the logger with the specified tag exists in the global registry, it is returned, else a new one is created and a pointer to the same is returend.

Parameters:
inputTag logger tag, viz. "x.y.z"
level log level associated with the logging control point (All messages with log levels less than equal to the log level of the control point would be logged)
oAppenderInheritance 
Returns:
PVLogger* Pointer to the logging control point
Exceptions:
leaves if out of memory

Referenced by OsclDNSMethod::OsclDNSMethod().

log_level_type PVLogger::GetLogLevel (  )  [inline]

This method returns the log level of a control point. This could either have been set explicitly by the user (at the time of creation or later) or could have been inherited from one of its ancestors.

Returns:
log level associated with the logging control point
uint32 PVLogger::GetNumAppenders (  )  [inline]

This method returns the number of appenders attached to the logging control point.

References Oscl_Vector_Base::size().

PVLogger* PVLogger::GetParent (  )  [inline, protected]
static OSCL_IMPORT_REF void PVLogger::Init (  )  [static]

PVLogger needs to be initialized once per thread. This creates the PVLogger singleton that is used throughout the duration of the thread. Initialization must occur before the first message is logged.

Exceptions:
leaves if out of memory
OSCL_IMPORT_REF bool PVLogger::IsActive ( log_level_type  level  ) 

This method determines if a msg passed to the logging control point is active or not. Only messages that are deemed active are logged. Messages are considered not active if any of the following criteria are met:

  • All logging is disabled at this logging control point
  • If all the log levels, leading upto the root log point are uninitialized
  • If the log level of the incoming message is LESS THAN that of the active log level of the logging control point.
Returns:
BOOL
OSCL_IMPORT_REF void PVLogger::LogMsgBuffers ( message_id_type  msgID,
int32  numPairs,
  ... 
)

This method logs opaque data buffers to all the appenders, after running thrrough the message filters. After logging the message to the appenders attached to the current control point, the message is passed up to the parent node, only if appender inheritance is enabled.

Parameters:
msgID Message ID, that is unique to a message
numPairs Number of (ptr_len, ptr) pairs
arguments Variable list of arguments
Returns:
NONE
OSCL_IMPORT_REF void PVLogger::LogMsgBuffersV ( message_id_type  msgID,
int32  numPairs,
va_list  arguments 
)

This method logs opaque data buffers to all the appenders, after running thrrough the message filters. After logging the message to the appenders attached to the current control point, the message is passed up to the parent node, only if appender inheritance is enabled.

Parameters:
msgID Message ID, that is unique to a message
numPairs Number of (ptr_len, ptr) pairs
arguments Variable list of arguments
Returns:
NONE
OSCL_IMPORT_REF void PVLogger::LogMsgString ( message_id_type  msgID,
const char *  fmt,
  ... 
)

This method logs formatted text msg to all the appenders, after running thrrough the message filters. After logging the message to the appenders attached to the current control point, the message is passed up to the parent node, only if appender inheritance is enabled.

Parameters:
msgID Message ID, that is unique to a message
fmt format string, similar to one taken by printf
arguments Variable list of arguments
Returns:
NONE
OSCL_IMPORT_REF void PVLogger::LogMsgStringV ( message_id_type  msgID,
const char *  fmt,
va_list  arguments 
)

This method logs formatted text msg to all the appenders, after running thrrough the message filters. After logging the message to the appenders attached to the current control point, the message is passed up to the parent node, only if appender inheritance is enabled.

Parameters:
msgID Message ID, that is unique to a message
fmt format string, similar to one taken by printf
arguments Variable list of arguments
Returns:
NONE
void PVLogger::RemoveAppender ( OsclSharedPtr< PVLoggerAppender > &  appender  )  [inline]

This method removes an appender from the logging control point. Each logger maintains a list of appenders. Any msg to a logger if deemed active is logged to all the appenders.

Parameters:
appender pointer to the appender to delete
Returns:
NONE

References Oscl_Vector< T, Alloc >::begin(), Oscl_Vector< T, Alloc >::end(), Oscl_Vector< T, Alloc >::erase(), OsclSharedPtr< TheClass >::GetRep(), and OSCL_UNUSED_ARG.

void PVLogger::SetLogLevel ( log_level_type  level  )  [inline]

This method is used to set the log level of a control point.

Parameters:
level log level associated with the logging control point
Returns:
NONE

References OSCL_UNUSED_ARG.

OSCL_IMPORT_REF void PVLogger::SetLogLevelAndPropagate ( log_level_type  level  ) 

This method is used to set the log level of a control point, as well as to propagate the level to all the descendants of this control point.

Parameters:
level log level associated with the logging control point
Returns:
NONE
void PVLogger::SetParent ( PVLogger parentLogger  )  [inline, protected]

Friends And Related Function Documentation

friend class PVLoggerRegistry [friend]

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

OSCL API
Posting Version: CORE_9.002.1.1