Main Page | Modules | Namespace List | Class Hierarchy | Class List | Directories | File List | Namespace Members | Class Members | File Members | Related Pages

CP_BufferedLogFile Class Reference

CP_BufferedLogFile. More...

Inheritance diagram for CP_BufferedLogFile:

CP_LogFile List of all members.

Public Member Functions

void SetLevel (UInt32 inLevel)
UInt32 GetLevel () const
UInt32 GetMode () const
void SetOptions (UInt32 inOptions)
UInt32 GetOptions () const
CP_E_LogFile_Status GetStatus () const
const char * GetFilename () const
void SetSyslogPriorityThreshold (int inSysLogPriority, UInt32 inLogLevelThreshold)
 Set the threshold to use a specific syslog priority.
void SetSyslogFacility (int inSysLogFacility)
Constructor / Destructor
 CP_BufferedLogFile (char newLineChar)
 Constructor.
virtual ~CP_BufferedLogFile ()
 Destructor.
Logging
SInt32 Flush ()
Control
SInt32 Start (const char *inFile, UInt32 inType=CP_E_LogOptions_ExplicitPath|CP_E_LogOptions_LogToDebug, UInt32 inOptions=CP_E_LogFile_ShowAll, UInt32 inLevel=0)
SInt32 Start (const CP_FileSystemSpec &inFileSpec, UInt32 inType=CP_E_LogOptions_ExplicitPath|CP_E_LogOptions_LogToDebug, UInt32 inOptions=CP_E_LogFile_ShowAll, UInt32 inLevel=0)
SInt32 Start (UInt32 inType=CP_E_LogOptions_LogToDebug, UInt32 inOptions=CP_E_LogFile_ShowAll, UInt32 inLevel=0)
SInt32 Pause ()
SInt32 Continue ()
SInt32 Stop ()
Logging
SInt32 LogMessage (const char *inMessage, UInt32 inLevel=0)
SInt32 LogMessage (UInt32 inLevel, const char *inFormatStr,...)
SInt32 VLogMessage (UInt32 inLevel, const char *inFormatStr, va_list args)
Control
SInt32 Start (const char *inFile, UInt32 inType=CP_E_LogOptions_ExplicitPath|CP_E_LogOptions_LogToDebug, UInt32 inOptions=CP_E_LogFile_ShowAll, UInt32 inLevel=0)
SInt32 Start (const CP_FileSystemSpec &inFileSpec, UInt32 inType=CP_E_LogOptions_ExplicitPath|CP_E_LogOptions_LogToDebug, UInt32 inOptions=CP_E_LogFile_ShowAll, UInt32 inLevel=0)
SInt32 Start (UInt32 inType=CP_E_LogOptions_LogToDebug, UInt32 inOptions=CP_E_LogFile_ShowAll, UInt32 inLevel=0)
SInt32 Pause ()
SInt32 Continue ()
SInt32 Stop ()
Logging
SInt32 LogMessage (const char *inMessage, UInt32 inLevel=0)
SInt32 LogMessage (UInt32 inLevel, const char *inFormatStr,...)
SInt32 VLogMessage (UInt32 inLevel, const char *inFormatStr, va_list args)

Protected Member Functions

Logging
virtual SInt32 LogMessageSelf (const char *inMessage, UInt32 inLevel=0)
SInt32 FlushSelf (bool inMutexLocked)

Protected Attributes

CP_String fStreamBuffer
UInt32 fStreamLevel
char fNewLineChar
CP_Mutex fStreamBufferMutex
 mutex to synchronize access to fStreamBuffer
FILE * fOutfile
UInt32 fOptions
UInt32 fLevel
CP_E_LogFile_Status fStatus
UInt32 fMode
UInt32 fCount
char fFile [255]
bool fEmptyFileFlag
bool fLogToFileFlag
char fMessage [1024]
char fBuffer [1024]
char fBuffer1 [1024]
UInt32 fSyslogPriorityThresholds [32]
int fSyslogFacility
CP_Mutex fBufferMutex
 mutex to synchronize access to fBuffer.
CP_Mutex fLogMutex
 mutex to serialize LogMessage calls

Detailed Description

Class to handle buffered 9stream) logging of messages to either a file or a debugger. The messages are buffered until the line ending character is found.


Constructor & Destructor Documentation

CP_BufferedLogFile::CP_BufferedLogFile char  inNewLineChar  ) 
 

Constructor.

Exceptions:
none 

CP_BufferedLogFile::~CP_BufferedLogFile  )  [virtual]
 

Destructor.

Exceptions:
none 


Member Function Documentation

SInt32 CP_BufferedLogFile::Flush  ) 
 

Flush (write) the buffered message to the log file.

Exceptions:
none 
Returns:
SInt32 The status of the flushing.

SInt32 CP_BufferedLogFile::LogMessageSelf const char *  inMsg,
UInt32  inLevel = 0
[protected, virtual]
 

Log a message to the log. The message is buffered until the line ending character is found then it will be sent to the log file.

Parameters:
inMsg The text of the message.
inLevel The indent level of the message.
Exceptions:
none 
Returns:
void

Reimplemented from CP_LogFile.

SInt32 CP_BufferedLogFile::FlushSelf bool  inMutexLocked  )  [protected]
 

Flush the buffered test to the stream.

Parameters:
inMutexLocked Flag to indicate if the stream buffer mutux should be locked.
Exceptions:
none 
Returns:
CP_E_LogReturn_Success

SInt32 CP_LogFile::Start const char *  inFile,
UInt32  inMode = CP_E_LogOptions_ExplicitPath | CP_E_LogOptions_LogToDebug,
UInt32  inOptions = CP_E_LogFile_ShowAll,
UInt32  inLevel = 0
[inherited]
 

Start logging messages to this class.

Parameters:
inFile The name of the log file produced.
inMode Controls where / how the log file is created.
inOptions Sets the CP_E_LogFile_LogOptions used in this class.
inLevel Sets the level used to control the indenting of the messages.
Exceptions:
none 
Returns:
SInt32 Returns the status of the log file, and can be one of the following values:
  • CP_E_LogReturn_Success,
  • CP_E_LogReturn_UnableToOpenFile,
  • CP_E_LogReturn_NotLogging,
  • CP_E_LogReturn_NotPaused,
  • CP_E_LogReturn_AlreadyStarted,
  • CP_E_LogReturn_NoLoggingModeSpecified,
  • CP_E_LogReturn_TooManyModesSpecified

SInt32 CP_LogFile::Start const CP_FileSystemSpec inFileSpec,
UInt32  inMode = CP_E_LogOptions_ExplicitPath | CP_E_LogOptions_LogToDebug,
UInt32  inOptions = CP_E_LogFile_ShowAll,
UInt32  inLevel = 0
[inherited]
 

Start logging messages to this class.

Parameters:
inSpec File system spec of the log file produced.
inMode Controls where / how the log file is created.
inOptions Sets the CP_E_LogFile_LogOptions used in this class.
inLevel Sets the level used to control the indenting of the messages.
Exceptions:
none 
Returns:
SInt32 Returns the status of the log file, and can be one of the following values:
  • CP_E_LogReturn_Success,
  • CP_E_LogReturn_UnableToOpenFile,
  • CP_E_LogReturn_NotLogging,
  • CP_E_LogReturn_NotPaused,
  • CP_E_LogReturn_AlreadyStarted,
  • CP_E_LogReturn_NoLoggingModeSpecified,
  • CP_E_LogReturn_TooManyModesSpecified

SInt32 CP_LogFile::Start UInt32  inMode = CP_E_LogOptions_LogToDebug,
UInt32  inOptions = CP_E_LogFile_ShowAll,
UInt32  inLevel = 0
[inherited]
 

Start logging messages to this class. This version does not specify a file name.

Parameters:
inMode Controls where / how the log file is created.
inOptions Sets the CP_E_LogFile_LogOptions used in this class.
inLevel Sets the level used to control the indenting of the messages.
Exceptions:
none 
Returns:
SInt32 Returns the status of the log file, and can be one of the following values:
  • CP_E_LogReturn_Success,
  • CP_E_LogReturn_UnableToOpenFile,
  • CP_E_LogReturn_NotLogging,
  • CP_E_LogReturn_NotPaused,
  • CP_E_LogReturn_AlreadyStarted,
  • CP_E_LogReturn_NoLoggingModeSpecified,
  • CP_E_LogReturn_TooManyModesSpecified

SInt32 CP_LogFile::Pause  )  [inherited]
 

Temporarily pause the logging of messages, and sets the status to CP_E_LogStatus_Paused.

Exceptions:
none 
Returns:
SInt32 Returns CP_E_LogReturn_Success.

SInt32 CP_LogFile::Continue  )  [inherited]
 

Continue logging of messages. Call this if you have paused logging, and sets the status to CP_E_LogStatus_Ready.

Exceptions:
none 
Returns:
SInt32 Returns CP_E_LogReturn_Success.

SInt32 CP_LogFile::Stop  )  [inherited]
 

Stop logging messages to this class.

Exceptions:
none 
Returns:
SInt32 Returns the status of the log file, and can be one of the following values:
  • CP_E_LogStatus_NotCP_E_LogStatus_Ready,
  • CP_E_LogStatus_Ready,
  • CP_E_LogStatus_Paused

SInt32 CP_LogFile::LogMessage const char *  inMessage,
UInt32  inLevel = 0
[inherited]
 

Log a message to the log.

Parameters:
inMsg The text of the message.
inLevel The indent level of the message.
Exceptions:
none 
Returns:
SInt32 Returns one of the status messages to indicate the sucess of writing the message. Currently we only return CP_E_LogReturn_Success.

SInt32 CP_LogFile::LogMessage UInt32  inLevel,
const char *  formatStr,
  ...
[inherited]
 

Log a formatted message.

Parameters:
inLevel The level of the message.
formatStr Controls how any remaining parameters are interpreted in the formatting of the message.
Exceptions:
none 
Returns:
SInt32 Returns the status of the logging.

SInt32 CP_LogFile::VLogMessage UInt32  inLevel,
const char *  formatStr,
va_list  args
[inherited]
 

Log a formatted message.

Parameters:
inLevel The level of the message.
formatStr Controls how any remaining parameters are interpreted in the formatting of the message.
args Variable list of additional params.
Exceptions:
none 
Returns:
SInt32 Returns the status of the logging.

void CP_LogFile::SetLevel UInt32  inLevel  )  [inherited]
 

Set the level of the error, which controls the level of indenting in the file.

Parameters:
inLevel The level of indenting to use.
Exceptions:
none 
Returns:
void

UInt32 CP_LogFile::GetLevel  )  const [inherited]
 

Returns the level of the error.

Exceptions:
none 
Returns:
UInt32 The level of indenting.

UInt32 CP_LogFile::GetMode  )  const [inherited]
 

Returns the logging mode in use, which controls where / how the log file is created.

Exceptions:
none 
Returns:
UInt32 The mode in use.

void CP_LogFile::SetOptions UInt32  inOptions  )  [inherited]
 

Sets the options that control varius aspects of how the logging takes place. The following are valid options to pass in:

  • CP_E_LogOptions_ExplicitPath
  • CP_E_LogOptions_TempDirectory
  • CP_E_LogOptions_LogDirectory
  • CP_E_LogOptions_SystemLogDirectory
  • CP_E_LogOptions_DeleteIfEmpty
  • CP_E_LogOptions_AppendFile
  • CP_E_LogOptions_LogToDebug
  • CP_E_LogOptions_LogToConsole
  • CP_E_LogOptions_LogToSyslog

Exceptions:
none 
Returns:
void

UInt32 CP_LogFile::GetOptions  )  const [inherited]
 

Returns the logging options in effect.

Exceptions:
none 
Returns:
UInt32 The current logging options.

CP_E_LogFile_Status CP_LogFile::GetStatus  )  const [inherited]
 

Returns the current status of the log file, and can be one of the following values:

  • CP_E_LogStatus_NotCP_E_LogStatus_Ready,
  • CP_E_LogStatus_Ready,
  • CP_E_LogStatus_Paused

Exceptions:
none 
Returns:
CP_E_LogFile_Status The current log file status.

const char* CP_LogFile::GetFilename  )  const [inherited]
 

Returns the file name of the log.

Exceptions:
none 
Returns:
const char * The file name of the log.

void CP_LogFile::SetSyslogPriorityThreshold int  inSysLogPriority,
UInt32  inLogLevelThreshold
[inherited]
 

Defines the threshold of when to use the specified syslog level:
A log message will be logged with the largest syslog priority for which the threshold is less or equal to the message level. The default level, if nothing else set is to use LOG_INFO.

Note:
Thresholds are examined in order of descending syslog priority. This means that you'll have to specify increasing log levels to decreasing syslog priorities, otherwise, the highest syslog priority that has a log level which is larger than the message level will be used.
Example:
  • LOG_CRIT mapped to threshold 3
  • LOG_ERR mapped to threshold 10
  • LOG_WARNING mapped to threshold 20 A message level of 5 will be reported as LOG_CRIT, a message level of 2 will not be reported, a message level of 15 will be reported as LOG_ERR, etc.
Parameters:
inSysLogPriority The syslog priority for which to set the threshold.
inLogLevelThreshold The log level threshold when to use this priority (see above). Pass UINT_MAX to disable logging with this priority.
Exceptions:
none 
Returns:
void

void CP_LogFile::SetSyslogFacility int  inSysLogFacility  )  [inherited]
 

Set the sys log facility.

Parameters:
inSysLogFacility The syslog facility.
Exceptions:
none 
Returns:
void


Member Data Documentation

CP_String CP_BufferedLogFile::fStreamBuffer [protected]
 

UInt32 CP_BufferedLogFile::fStreamLevel [protected]
 

char CP_BufferedLogFile::fNewLineChar [protected]
 

CP_Mutex CP_BufferedLogFile::fStreamBufferMutex [protected]
 

FILE* CP_LogFile::fOutfile [protected, inherited]
 

UInt32 CP_LogFile::fOptions [protected, inherited]
 

UInt32 CP_LogFile::fLevel [protected, inherited]
 

CP_E_LogFile_Status CP_LogFile::fStatus [protected, inherited]
 

UInt32 CP_LogFile::fMode [protected, inherited]
 

UInt32 CP_LogFile::fCount [protected, inherited]
 

char CP_LogFile::fFile[255] [protected, inherited]
 

bool CP_LogFile::fEmptyFileFlag [protected, inherited]
 

bool CP_LogFile::fLogToFileFlag [protected, inherited]
 

char CP_LogFile::fMessage[1024] [protected, inherited]
 

char CP_LogFile::fBuffer[1024] [protected, inherited]
 

char CP_LogFile::fBuffer1[1024] [protected, inherited]
 

UInt32 CP_LogFile::fSyslogPriorityThresholds[32] [protected, inherited]
 

int CP_LogFile::fSyslogFacility [protected, inherited]
 

CP_Mutex CP_LogFile::fBufferMutex [protected, inherited]
 

CP_Mutex CP_LogFile::fLogMutex [protected, inherited]
 


The documentation for this class was generated from the following files:
Generated on Tue Sep 20 20:21:34 2005 for CPLAT_MacOS by  doxygen 1.4.0