Main Page | Class Hierarchy | Alphabetical List | Compound List | File List | Compound Members | File Members | Related Pages

LOW_helper_msglog Class Reference

Static class for message logging. More...

#include <LOW_helper_msglog.h>

List of all members.

Public Types

enum  debugLevel_t {
  portSerial_dl, objSync_getLock_dl, objSync_lockFailed_dl, linkDS2490_dl,
  all_dl
}
 Type defining debug levels. More...


Static Public Member Functions

void setDebugLevelEnabled (const debugLevel_t inLevel, const bool isEnabled=true)
 Enable/disable logging of debug messages of a certain level.

bool getDebugLevelEnabled (const debugLevel_t inLevel)
 Get whether logging of debug messages of a certain level is enabled.

void printPerror (const int inErrno, const char *inFormat,...)
 Print error message.

void printError (const char *inFormat,...)
 Print error message.

void printWarning (const char *inFormat,...)
 Print warning message.

void printMessage (const char *inFormat,...)
 Print message.

void printDebug (const debugLevel_t inLevel, const char *inFormat,...)
 Print message.


Private Types

enum  logType_t { msg_log, warn_log, err_log, debug_log }
 Internal type to mark type of message. More...


Private Member Functions

 LOW_helper_msglog ()
 Default constructor.

 ~LOW_helper_msglog ()
 Destructor.


Static Private Member Functions

void va_printToLog (const logType_t inLogType, const char *inFormat, va_list inParamList)
unsigned int fprintLogHeader (FILE *inExtraStream, FILE *inStdStream)
void fprintfMulti (FILE *inExtraStream, FILE *inStdStream, const char *inFormat,...)
void vfprintfMulti (FILE *inExtraStream, FILE *inStdStream, const char *inFormat, va_list inAp)
void * callocCheck (const size_t inSize)

Static Private Attributes

bool errorOccured = false
bool debugLevels [all_dl]
bool useStdMsgStream = true
bool useStdWarnStream = true
bool useStdErrStream = true
bool useStdDebugStream = true
bool useExtraMsgStream = false
bool useExtraWarnStream = false
bool useExtraErrStream = false
bool useExtraDebugStream = false
FILE * stdOutStream = stdout
FILE * stdWarnStream = stderr
FILE * stdErrStream = stderr
FILE * stdDebugStream = stderr
FILE * extraOutStream = NULL
FILE * extraWarnStream = NULL
FILE * extraErrStream = NULL
FILE * extraDebugStream = NULL


Detailed Description

Static class for message logging.

Distinguishes error/warning/normal and debugging messages. Debugging support arbitrary debug levels.

This class is thread-safe.

Todo:
Finish implementation of class, namely additional output streams.

Bug:
printXXX( "\n") gives "(NULL)" output.
Author:
Harald Roelle

Definition at line 42 of file LOW_helper_msglog.h.


Member Enumeration Documentation

enum LOW_helper_msglog::debugLevel_t
 

Type defining debug levels.

Enumeration values:
portSerial_dl  Debugging of serial port communication.
objSync_getLock_dl  Debugging of successfully obtaining a lock in LOW_objectSynchronizer.
objSync_lockFailed_dl  Debugging of failing to obtain a lock in LOW_objectSynchronizer.
linkDS2490_dl  Debugging of DS2490.
all_dl  This one MUST be the last!

Definition at line 53 of file LOW_helper_msglog.h.

enum LOW_helper_msglog::logType_t [private]
 

Internal type to mark type of message.

Enumeration values:
msg_log 
warn_log 
err_log 
debug_log 

Definition at line 170 of file LOW_helper_msglog.h.


Constructor & Destructor Documentation

LOW_helper_msglog::LOW_helper_msglog  )  [private]
 

Default constructor.

It is private to prevent creating objects from this class as this is a static helper class.

Definition at line 66 of file LOW_helper_msglog.cpp.

LOW_helper_msglog::~LOW_helper_msglog  )  [private]
 

Destructor.

It is private to prevent creating objects from this class as this is a static helper class.

Definition at line 71 of file LOW_helper_msglog.cpp.


Member Function Documentation

void * LOW_helper_msglog::callocCheck const size_t  inSize  )  [static, private]
 

Definition at line 291 of file LOW_helper_msglog.cpp.

References printPerror().

void LOW_helper_msglog::fprintfMulti FILE *  inExtraStream,
FILE *  inStdStream,
const char *  inFormat,
... 
[static, private]
 

Definition at line 275 of file LOW_helper_msglog.cpp.

References vfprintfMulti().

Referenced by fprintLogHeader(), and va_printToLog().

unsigned int LOW_helper_msglog::fprintLogHeader FILE *  inExtraStream,
FILE *  inStdStream
[static, private]
 

Definition at line 261 of file LOW_helper_msglog.cpp.

References fprintfMulti(), and LOW_platformMisc::getThreadID().

Referenced by va_printToLog().

bool LOW_helper_msglog::getDebugLevelEnabled const debugLevel_t  inLevel  )  [static]
 

Get whether logging of debug messages of a certain level is enabled.

Parameters:
inLevel Debug level to query.
Returns:
True if logging is enabled.

Definition at line 89 of file LOW_helper_msglog.cpp.

References debugLevels.

void LOW_helper_msglog::printDebug const debugLevel_t  inLevel,
const char *  inFormat,
... 
[static]
 

Print message.

Parameters:
inLevel Debug level the message belongs to.
inFormat Format string as in ANSI-C printf().
... Variable argument list as in ANSI-C printf().

Definition at line 178 of file LOW_helper_msglog.cpp.

References all_dl, debug_log, debugLevels, and va_printToLog().

Referenced by LOW_objectSynchronizer::__synchronizeMethodRead::__synchronizeMethodRead(), LOW_objectSynchronizer::__synchronizeMethodReadWeak::__synchronizeMethodReadWeak(), LOW_objectSynchronizer::__synchronizeMethodWrite::__synchronizeMethodWrite(), LOW_objectSynchronizer::__synchronizeMethodWriteWeak::__synchronizeMethodWriteWeak(), LOW_objectSynchronizer::__synchronizeStaticRead::__synchronizeStaticRead(), LOW_objectSynchronizer::__synchronizeStaticReadWeak::__synchronizeStaticReadWeak(), LOW_objectSynchronizer::__synchronizeStaticWrite::__synchronizeStaticWrite(), LOW_objectSynchronizer::__synchronizeStaticWriteWeak::__synchronizeStaticWriteWeak(), LOW_linkDS2490::comCmd_bitIO(), LOW_linkDS2490::comCmd_blockIO(), LOW_linkDS2490::comCmd_byteIO(), LOW_linkDS2490::comCmd_doAndRelease(), LOW_linkDS2490::comCmd_matchAccess(), LOW_linkDS2490::comCmd_oneWireReset(), LOW_linkDS2490::comCmd_pulse(), LOW_linkDS2490::comCmd_readCrcProtPage(), LOW_linkDS2490::comCmd_readRedirectPageCrc(), LOW_linkDS2490::comCmd_readStraight(), LOW_linkDS2490::comCmd_searchAccess(), LOW_linkDS2490::comCmd_setDuration(), LOW_linkDS2490::comCmd_setPath(), LOW_linkDS2490::comCmd_writeEprom(), LOW_linkDS2490::comCmd_writeSramPage(), LOW_linkDS2490::commonConstructorActions(), LOW_linkDS2490::ctlCmd_flushCommCmds(), LOW_linkDS2490::ctlCmd_flushDataRcvBuffer(), LOW_linkDS2490::ctlCmd_flushDataXmtBuffer(), LOW_linkDS2490::ctlCmd_getCommCmds(), LOW_linkDS2490::ctlCmd_haltExecutionWhenDone(), LOW_linkDS2490::ctlCmd_haltExecutionWhenIdle(), LOW_linkDS2490::ctlCmd_resetDevice(), LOW_linkDS2490::ctlCmd_resumeExecution(), LOW_linkDS2490::ctlCmd_startExecution(), LOW_linkDS2490::doSearchSequence(), LOW_linkDS2490::getPullDownSlewRate(), LOW_linkDS2490::getSampleOffsetWrite0Rec(), LOW_linkDS2490::getWireSpeed(), LOW_linkDS2490::getWrite1LowTime(), LOW_linkDS2490::handleCommonComCmdBits(), LOW_linkDS2490::modCmd_setDsoW0RecoveryTime(), LOW_linkDS2490::modCmd_setEnablePulse(), LOW_linkDS2490::modCmd_setEnableSpeedChange(), LOW_linkDS2490::modCmd_setOneWireSpeed(), LOW_linkDS2490::modCmd_setProgPulseDuration(), LOW_linkDS2490::modCmd_setPulldownSlewRate(), LOW_linkDS2490::modCmd_setStrongPullupDuration(), LOW_linkDS2490::modCmd_setWrite1LowTime(), LOW_linkDS2490::progPulseInternal(), LOW_linkDS2490::programPulse(), LOW_linkDS2490::readDeviceStatus(), LOW_linkDS2490::resetBus(), LOW_linkDS2490::resetLinkAdapter(), LOW_linkDS2490::searchDevices(), LOW_linkDS2490::setPullDownSlewRate(), LOW_linkDS2490::setSampleOffsetWrite0Rec(), LOW_linkDS2490::setWireSpeed(), LOW_linkDS2490::setWrite1LowTime(), LOW_linkDS2490::strongPullup(), LOW_linkDS2490::strongPullupInternal(), LOW_linkDS2490::touchBit(), LOW_linkDS2490::touchBlock(), LOW_linkDS2490::touchByte(), LOW_portSerial_Linux::tty_readByte(), LOW_portSerial_Linux::tty_write(), and LOW_linkDS2490::waitUntilIdle().

void LOW_helper_msglog::printError const char *  inFormat,
... 
[static]
 

Print error message.

Parameters:
inFormat Format string as in ANSI-C printf().
... Variable argument list as in ANSI-C printf().

Definition at line 139 of file LOW_helper_msglog.cpp.

References err_log, and va_printToLog().

Referenced by LOW_exception::logException(), and printPerror().

void LOW_helper_msglog::printMessage const char *  inFormat,
... 
[static]
 

Print message.

Parameters:
inFormat Format string as in ANSI-C printf().
... Variable argument list as in ANSI-C printf().

Definition at line 165 of file LOW_helper_msglog.cpp.

References msg_log, and va_printToLog().

void LOW_helper_msglog::printPerror const int  inErrno,
const char *  inFormat,
... 
[static]
 

Print error message.

Parameters:
inErrno OS error number.
inFormat Format string as in ANSI-C printf().
... Variable argument list as in ANSI-C printf().

Definition at line 103 of file LOW_helper_msglog.cpp.

References printError().

Referenced by callocCheck(), LOW_exception::logException(), LOW_portUsbDevice_Linux::~LOW_portUsbDevice_Linux(), LOW_thread_mutex_POSIX::~LOW_thread_mutex_POSIX(), LOW_thread_rwlock_POSIX::~LOW_thread_rwlock_POSIX(), and LOW_thread_thread_POSIX::~LOW_thread_thread_POSIX().

void LOW_helper_msglog::printWarning const char *  inFormat,
... 
[static]
 

Print warning message.

Parameters:
inFormat Format string as in ANSI-C printf().
... Variable argument list as in ANSI-C printf().

Definition at line 152 of file LOW_helper_msglog.cpp.

References va_printToLog(), and warn_log.

void LOW_helper_msglog::setDebugLevelEnabled const debugLevel_t  inLevel,
const bool  isEnabled = true
[static]
 

Enable/disable logging of debug messages of a certain level.

Parameters:
inLevel Debug level to set logging for.
isEnabled Whether to enable or disable logging.

Definition at line 82 of file LOW_helper_msglog.cpp.

References debugLevels.

void LOW_helper_msglog::va_printToLog const logType_t  inLogType,
const char *  inFormat,
va_list  inParamList
[static, private]
 

Definition at line 205 of file LOW_helper_msglog.cpp.

References debug_log, err_log, extraDebugStream, extraErrStream, extraOutStream, extraWarnStream, fprintfMulti(), fprintLogHeader(), msg_log, stdDebugStream, stdErrStream, stdOutStream, stdWarnStream, useExtraDebugStream, useExtraErrStream, useExtraMsgStream, useExtraWarnStream, useStdDebugStream, useStdErrStream, useStdMsgStream, useStdWarnStream, and warn_log.

Referenced by printDebug(), printError(), printMessage(), and printWarning().

void LOW_helper_msglog::vfprintfMulti FILE *  inExtraStream,
FILE *  inStdStream,
const char *  inFormat,
va_list  inAp
[static, private]
 

Definition at line 284 of file LOW_helper_msglog.cpp.

Referenced by fprintfMulti().


Member Data Documentation

bool LOW_helper_msglog::debugLevels [static, private]
 

Definition at line 39 of file LOW_helper_msglog.cpp.

Referenced by getDebugLevelEnabled(), printDebug(), and setDebugLevelEnabled().

bool LOW_helper_msglog::errorOccured = false [static, private]
 

Definition at line 38 of file LOW_helper_msglog.cpp.

FILE * LOW_helper_msglog::extraDebugStream = NULL [static, private]
 

Definition at line 57 of file LOW_helper_msglog.cpp.

Referenced by va_printToLog().

FILE * LOW_helper_msglog::extraErrStream = NULL [static, private]
 

Definition at line 56 of file LOW_helper_msglog.cpp.

Referenced by va_printToLog().

FILE * LOW_helper_msglog::extraOutStream = NULL [static, private]
 

Definition at line 54 of file LOW_helper_msglog.cpp.

Referenced by va_printToLog().

FILE * LOW_helper_msglog::extraWarnStream = NULL [static, private]
 

Definition at line 55 of file LOW_helper_msglog.cpp.

Referenced by va_printToLog().

FILE * LOW_helper_msglog::stdDebugStream = stderr [static, private]
 

Definition at line 53 of file LOW_helper_msglog.cpp.

Referenced by va_printToLog().

FILE * LOW_helper_msglog::stdErrStream = stderr [static, private]
 

Definition at line 52 of file LOW_helper_msglog.cpp.

Referenced by va_printToLog().

FILE * LOW_helper_msglog::stdOutStream = stdout [static, private]
 

Definition at line 50 of file LOW_helper_msglog.cpp.

Referenced by va_printToLog().

FILE * LOW_helper_msglog::stdWarnStream = stderr [static, private]
 

Definition at line 51 of file LOW_helper_msglog.cpp.

Referenced by va_printToLog().

bool LOW_helper_msglog::useExtraDebugStream = false [static, private]
 

Definition at line 48 of file LOW_helper_msglog.cpp.

Referenced by va_printToLog().

bool LOW_helper_msglog::useExtraErrStream = false [static, private]
 

Definition at line 47 of file LOW_helper_msglog.cpp.

Referenced by va_printToLog().

bool LOW_helper_msglog::useExtraMsgStream = false [static, private]
 

Definition at line 45 of file LOW_helper_msglog.cpp.

Referenced by va_printToLog().

bool LOW_helper_msglog::useExtraWarnStream = false [static, private]
 

Definition at line 46 of file LOW_helper_msglog.cpp.

Referenced by va_printToLog().

bool LOW_helper_msglog::useStdDebugStream = true [static, private]
 

Definition at line 44 of file LOW_helper_msglog.cpp.

Referenced by va_printToLog().

bool LOW_helper_msglog::useStdErrStream = true [static, private]
 

Definition at line 43 of file LOW_helper_msglog.cpp.

Referenced by va_printToLog().

bool LOW_helper_msglog::useStdMsgStream = true [static, private]
 

Definition at line 41 of file LOW_helper_msglog.cpp.

Referenced by va_printToLog().

bool LOW_helper_msglog::useStdWarnStream = true [static, private]
 

Definition at line 42 of file LOW_helper_msglog.cpp.

Referenced by va_printToLog().


The documentation for this class was generated from the following files:
Generated on Tue Feb 3 11:30:57 2004 for OneWireLibrary++ by doxygen 1.3.2