sipxportlib  Version 3.3
Public Types | Static Public Member Functions | Static Public Attributes | Protected Member Functions | Static Protected Member Functions | Static Protected Attributes | List of all members
OsSysLog Class Reference

#include <OsSysLog.h>

Collaboration diagram for OsSysLog:
Collaboration graph
[legend]

Public Types

enum  OsSysLogOptions { OPT_NONE = 0x00000000, OPT_SHARED_LOGFILE = 0x00000001 }
 

Static Public Member Functions

static OsStatus initialize (const int maxInMemoryLogEntries, const char *processId, const int options=OPT_NONE)
 enumcode: OPT_NONE - No Extra Options More...
 
static OsStatus shutdown ()
 param maxInMemoryLogEntries - Defines the maximum number of in-memory More...
 
static OsStatus setOutputFile (const int minFlushPeriod, const char *logfile)
 
static OsStatus setCallbackFunction (OsSysLogCallback pCallback)
 param minFlushPeriod - Defines the minimum amount of that that must More...
 
static OsStatus addOutputSocket (const char *remoteHost)
 param pCallback - Pointer to a callback function that takes three More...
 
static OsStatus enableConsoleOutput (const UtlBoolean enable)
 
static OsStatus setLoggingPriority (const OsSysLogPriority priority)
 param enable - Specify TRUE to enable console logging or FALSE to More...
 
static OsStatus setLoggingPriorityForFacility (const OsSysLogFacility facility, const OsSysLogPriority priority)
 param priority - Defines the minimum priority level of log events that More...
 
static OsStatus add (const char *taskName, const int taskId, const OsSysLogFacility facility, const OsSysLogPriority priority, const char *format,...)
 param facility - Defines the facility whose logging events should be More...
 
static OsStatus add (const OsSysLogFacility facility, const OsSysLogPriority priority, const char *format,...)
 param: taskName - The name of the task if available. param: taskId - The TaskID of the task if available. param: facility - Defines the facility responsible for adding the More...
 
static OsStatus vadd (const OsSysLogFacility facility, const OsSysLogPriority priority, const char *format, va_list ap)
 param: facility - Defines the facility responsible for adding the More...
 
static OsStatus vadd (const char *taskName, const OsTaskId_t taskId, const OsSysLogFacility facility, const OsSysLogPriority priority, const char *format, va_list ap)
 param: facility - Defines the facility responsible for adding the More...
 
static OsStatus clearInMemoryLog ()
 param: taskName - The name of the task if available. param: taskId - The TaskID of the task if available. param: facility - Defines the facility responsible for adding the More...
 
static OsStatus flush (const OsTime &rTimeout=OsTime::OS_INFINITY)
 
static void initSysLog (const OsSysLogFacility facility, const char *processID, const char *logname, const char *loglevel)
 
static OsStatus getMaxInMemoryLogEntries (int &maxEntries)
 
static OsStatus tailMemoryLog (const int numEntries)
 param maxEntries - The maximum number of in-memory log entries More...
 
static OsStatus headMemoryLog (const int numEntries)
 param: numEntries - The number of log entries display starting from More...
 
static OsStatus getLogEntries (const int maxEntries, char *entries[], int &actualEntries)
 param: numEntries - The number of log entries display starting from More...
 
static OsStatus parseLogString (const char *szSource, UtlString &date, UtlString &eventCount, UtlString &facility, UtlString &priority, UtlString &hostname, UtlString &taskname, UtlString &taskId, UtlString &processId, UtlString &content)
 param: maxEntries - The maximum number of entries to fetch. param: entries - Array of char* large enough to accommodate More...
 
static OsStatus getPriorityName (OsSysLogPriority priorityId, UtlString &name)
 
static OsStatus getPriorityForName (const UtlString &name, OsSysLogPriority &priorityId)
 
static OsSysLogPriority getLoggingPriority ()
 
static OsSysLogPriority getLoggingPriorityForFacility (const OsSysLogFacility facility)
 
static UtlBoolean willLog (OsSysLogFacility facility, OsSysLogPriority priority)
 
static int getNumFacilities ()
 
static OsTimer * getTimer ()
 
static UtlBoolean isTaskPtrNull ()
 

Static Public Attributes

static const char * sPriorityNames []
 
static const int sPriorityNamesNum
 
static const char * sFacilityNames []
 
static const int sFacilityNamesNum
 

Protected Member Functions

 OsSysLog (const OsSysLog &rOsSysLog)
 
OsSysLog & operator= (const OsSysLog &rhs)
 
 OsSysLog ()
 
virtual ~OsSysLog ()
 

Static Protected Member Functions

static UtlString escape (const UtlString &source)
 
static UtlString unescape (const UtlString &source)
 
static void getTaskInfo (UtlString &taskName, OsTaskId_t &taskId)
 

Static Protected Attributes

static OsAtomicLightPtr< OsSysLogTask > spOsSysLogTask
 
static OsAtomicULong sEventCount
 
static OsSysLogPriority spPriorities [FAC_MAX_FACILITY]
 
static OsSysLogPriority sLoggingPriority = PRI_ERR
 
static UtlString sProcessId = ""
 
static UtlString sHostname = ""
 
static UtlBoolean bPrioritiesInitialized = FALSE
 

Member Enumeration Documentation

Enumerator
OPT_NONE 
OPT_SHARED_LOGFILE 

Constructor & Destructor Documentation

OsSysLog ( const OsSysLog &  rOsSysLog)
protected
OsSysLog ( )
protected
~OsSysLog ( )
protectedvirtual

Member Function Documentation

OsStatus initialize ( const int  maxInMemoryLogEntries,
const char *  processId,
const int  options = OPT_NONE 
)
static

enumcode: OPT_NONE - No Extra Options

enumcode: OPT_SHARED_LOGFILE - Places the OsSysLog in a mode where

OsStatus shutdown ( )
static

param maxInMemoryLogEntries - Defines the maximum number of in-memory

param processId - This parameter represents an arbitrary identifier param options - This parameter defines instance specific options. See

OsStatus setOutputFile ( const int  minFlushPeriod,
const char *  logfile 
)
static
OsStatus setCallbackFunction ( OsSysLogCallback  pCallback)
static

param minFlushPeriod - Defines the minimum amount of that that must

param logfile - The full qualified path the the target log file.

OsStatus addOutputSocket ( const char *  remoteHost)
static

param pCallback - Pointer to a callback function that takes three

OsStatus enableConsoleOutput ( const UtlBoolean  enable)
static
OsStatus setLoggingPriority ( const OsSysLogPriority  priority)
static

param enable - Specify TRUE to enable console logging or FALSE to

OsStatus setLoggingPriorityForFacility ( const OsSysLogFacility  facility,
const OsSysLogPriority  priority 
)
static

param priority - Defines the minimum priority level of log events that

OsStatus add ( const char *  taskName,
const int  taskId,
const OsSysLogFacility  facility,
const OsSysLogPriority  priority,
const char *  format,
  ... 
)
static

param facility - Defines the facility whose logging events should be

param priority - Defines the minimum priority level of log events that

OsStatus add ( const OsSysLogFacility  facility,
const OsSysLogPriority  priority,
const char *  format,
  ... 
)
static

param: taskName - The name of the task if available. param: taskId - The TaskID of the task if available. param: facility - Defines the facility responsible for adding the

param: priority - Defines the priority of the event. See

OsStatus vadd ( const OsSysLogFacility  facility,
const OsSysLogPriority  priority,
const char *  format,
va_list  ap 
)
static

param: facility - Defines the facility responsible for adding the

param: priority - Defines the priority of the event. See

OsStatus vadd ( const char *  taskName,
const OsTaskId_t  taskId,
const OsSysLogFacility  facility,
const OsSysLogPriority  priority,
const char *  format,
va_list  ap 
)
static

param: facility - Defines the facility responsible for adding the

param: priority - Defines the priority of the event. See

OsStatus clearInMemoryLog ( )
static

param: taskName - The name of the task if available. param: taskId - The TaskID of the task if available. param: facility - Defines the facility responsible for adding the

param: priority - Defines the priority of the event. See

OsStatus flush ( const OsTime &  rTimeout = OsTime::OS_INFINITY)
static
void initSysLog ( const OsSysLogFacility  facility,
const char *  processID,
const char *  logname,
const char *  loglevel 
)
static
OsStatus getMaxInMemoryLogEntries ( int &  maxEntries)
static
OsStatus tailMemoryLog ( const int  numEntries)
static

param maxEntries - The maximum number of in-memory log entries

OsStatus headMemoryLog ( const int  numEntries)
static

param: numEntries - The number of log entries display starting from

OsStatus getLogEntries ( const int  maxEntries,
char *  entries[],
int &  actualEntries 
)
static

param: numEntries - The number of log entries display starting from

OsStatus parseLogString ( const char *  szSource,
UtlString &  date,
UtlString &  eventCount,
UtlString &  facility,
UtlString &  priority,
UtlString &  hostname,
UtlString &  taskname,
UtlString &  taskId,
UtlString &  processId,
UtlString &  content 
)
static

param: maxEntries - The maximum number of entries to fetch. param: entries - Array of char* large enough to accommodate

param: actualEntries - The actual number of entries returned. This

OsStatus getPriorityName ( OsSysLogPriority  priorityId,
UtlString &  name 
)
static
OsStatus getPriorityForName ( const UtlString &  name,
OsSysLogPriority &  priorityId 
)
static
OsSysLogPriority getLoggingPriority ( )
static
OsSysLogPriority getLoggingPriorityForFacility ( const OsSysLogFacility  facility)
static
UtlBoolean willLog ( OsSysLogFacility  facility,
OsSysLogPriority  priority 
)
static
int getNumFacilities ( )
static
OsTimer * getTimer ( )
static
static UtlBoolean isTaskPtrNull ( )
inlinestatic
OsSysLog & operator= ( const OsSysLog &  rhs)
protected
UtlString escape ( const UtlString &  source)
staticprotected
UtlString unescape ( const UtlString &  source)
staticprotected
void getTaskInfo ( UtlString &  taskName,
OsTaskId_t &  taskId 
)
staticprotected

Member Data Documentation

const char * sPriorityNames
static
Initial value:
=
{
"DEBUG",
"INFO",
"NOTICE",
"WARNING",
"ERR",
"CRIT",
"ALERT",
"EMERG"
}
const int sPriorityNamesNum
static
Initial value:
const char * sFacilityNames
static
const int sFacilityNamesNum
static
Initial value:
OsAtomicLightPtr< OsSysLogTask > spOsSysLogTask
staticprotected
OsAtomicULong sEventCount
staticprotected
OsSysLogPriority spPriorities
staticprotected
OsSysLogPriority sLoggingPriority = PRI_ERR
staticprotected
UtlString sProcessId = ""
staticprotected
UtlString sHostname = ""
staticprotected
UtlBoolean bPrioritiesInitialized = FALSE
staticprotected