#include <OTC/debug/logstrm.hh> class OTC_LogStream : public ostream {
public:
~OTC_LogStream();
OTC_LogStream(char* theBuffer=0, int theSize=0);
inline OTC_LogLevel setLevel(OTC_LogLevel theLevel);
};
OTC_LogStream
is a streams interface to the message
logging system implemented by the class OTC_Logger
. Typically,
you would not need to use the OTC_LogStream
class directly.
Instead, you should call the function OTCLIB_LOGGER()
to get
access to a central instance of the OTC_LogStream
class.
The maximum size message that can be accomodated by the stream
returned by OTCLIB_LOGGER()
is 2048
characters. If this is
exceeded, the message will be split over multiple lines. The
priority level at which you want messages to be logged, is
defined by passing the level as an argument to the
OTCLIB_LOGGER()
function.
Note that if your code needs to be thread safe, you should not
use OTCLIB_LOGGER()
but should create an instance of the
OTC_LogStream
class yourself.
OTCLIB_LOGGER()
function is
shown below.
OTCLIB_LOGGER(OTCLIB_LOG_WARNING) << "Bad argument" << flush;
To ensure that messages are sent, the stream should be flushed
explicitly. You can flush the stream by using the flush
manipulator or by using endl
. In either case, an end of line
character will be output if necessary.
OTC_LogStream(char* theBuffer=0, int theSize=0);
theBuffer
should be a block of memory in which the
class can format the messages.
theSize
should be the size of the
buffer you have provided.
inline OTC_LogLevel setLevel(OTC_LogLevel theLevel);
theLevel
. If the priority
level is not set explicitly, a default
of OTCLIB_LOG_DEBUG
set by the
constructor will be used.
OTC_LogBuf
, OTC_Logger