![]() |
Home | Libraries | Author | Links |
![]() |
The declarations of these utilities are all contained in the namespace stm.
In the following documentation the international standard C++ISO/IEC 14882:2003(E) is cited in the form of parenthesized expressions with the same syntax and semantics as inside this international standard itself.
Files | |
file | loggeraids.hpp |
Declarations of formatted logging aids. | |
Classes | |
class | stm::logger_base |
Common base class of all basic_logger class template specializations. More... | |
class | stm::basic_logger< StringT, stdIndent, lineLength, lockingPolicy > |
Class template to manage formatted logging on an output stream (normally a log file) and optionally on a second stream (normally a console) and on the system log (see stm::syslog()). More... | |
struct | stm::basic_logger< StringT, stdIndent, lineLength, lockingPolicy >::Fmt |
Format information for output streams. More... | |
struct | stm::basic_logger< StringT, stdIndent, lineLength, lockingPolicy >::locker |
Scoped locking for output streams. More... | |
class | stm::logger< stdIndent, lineLength, errorConsole, lockingPolicy > |
Class template to manage formatted logging on a std::string based output stream (normally a log file) and optionally on a second std::string based stream (normally a console, by default std::cout, if template parameter errorConsole is false (the default), or else std::cerr). More... | |
class | stm::wlogger< stdIndent, lineLength, errorConsole, lockingPolicy > |
Class template to manage formatted logging on a std::wstring based output stream (normally a log file) and optionally on a second std::wstring based stream (normally a console, by default std::wcout, if template parameter errorConsole is false (the default), or else std::wcerr). More... | |
Typedefs | |
typedef basic_logger< StringT, stdIndent, lineLength, lockingPolicy > | stm::basic_logger::logger_type |
This basic_logger type. | |
typedef StringT | stm::basic_logger::string_type |
String type. | |
typedef std::basic_ostream < typename string_type::value_type, typename string_type::traits_type > | stm::basic_logger::ostream_type |
Output stream type. | |
typedef impl::char_type | stm::basic_logger::char_type |
Character type. | |
Enumerations | |
enum | { stm::basic_logger::StdIndent = stdIndent, stm::basic_logger::LineLength = lineLength, stm::basic_logger::LockingPolicy = lockingPolicy } |
enum | stm::basic_logger::FmtFlags { stm::basic_logger::NoFlag = impl::NoFlag, stm::basic_logger::Indent = impl::Indent, stm::basic_logger::NoPara = impl::NoPara, stm::basic_logger::KeepWs = impl::KeepWs, stm::basic_logger::AutoInd = impl::AutoInd, stm::basic_logger::ColonInd = impl::ColonInd, stm::basic_logger::ColonTable = impl::ColonTable, stm::basic_logger::RiJust = impl::RiJust, stm::basic_logger::RawPath = impl::RawPath, stm::basic_logger::Single = impl::Single } |
Format information flags. More... | |
Functions | |
stm::basic_logger::Fmt::Fmt (word flags, word indent=StdIndent, word length=LineLength) | |
Constructs an object with format information flags, indent and length. | |
stm::basic_logger::locker::locker (const logger_type &logger) | |
Construct a scoped lock for logger. | |
stm::basic_logger::locker::~locker () | |
Destructor. | |
stm::basic_logger::basic_logger (const std::string &mutexName=std::string()) | |
Default constructor for a basic_logger object not to print. | |
stm::basic_logger::basic_logger (const logger_type &other) | |
Copy constructor. | |
stm::basic_logger::basic_logger (ostream_type &stream, const std::string &mutexName=std::string()) | |
Construct a basic_logger object to print on stream. | |
stm::basic_logger::basic_logger (ostream_type &stream, ostream_type &console, const std::string &mutexName=std::string()) | |
Construct a basic_logger object to print on stream and on console. | |
stm::basic_logger::~basic_logger () | |
Destroy a basic_logger object. | |
bool | stm::basic_logger::hasStream () const |
Return true, if this basic_logger object has a stream, else false. | |
void | stm::basic_logger::setStream (ostream_type &stream) |
Configure this basic_logger object to print on stream. | |
void | stm::basic_logger::unsetStream () |
Configure this basic_logger object to print on no stream. | |
bool | stm::basic_logger::hasConsole () const |
Return true, if this basic_logger object has a console, else false. | |
void | stm::basic_logger::setConsole (ostream_type &console) |
Configure this basic_logger object to print on console. | |
void | stm::basic_logger::unsetConsole () |
Configure this basic_logger object to print on no console. | |
int | stm::basic_logger::adjustChild () |
Adjust this basic_logger object after a call to fork(). | |
int | stm::basic_logger::operator() (Fmt streamFmt=Fmt(), Fmt consoleFmt=Fmt()) |
Print the contents of the string stream base of this basic_logger to the streams configured and then clear it. | |
int | stm::basic_logger::underline (int n, char_type ch=char_type('='), dword nl=1) |
Print character ch (default '=') n times to the streams configured, followed by nl times (default 1) the newline character. | |
int | stm::basic_logger::paragraph (dword nl=1) |
Print on each configured stream as much newlines that at least nl empty lines are present after the last recently printed non empty line. | |
static string_type | stm::basic_logger::mkPath (const string_type &str) |
Return a copy of str, if str does not contain white space, else str quoted by '"' characters. | |
stm::logger::logger (bool enableStream, const std::string &mutexName) | |
Construct a logger object to print on stream (default the standard console), if enableStream is true. | |
stm::logger::logger (std::ostream &stream, const std::string &mutexName) | |
Construct a logger object to print on stream. | |
stm::logger::logger (std::ostream &stream, bool enableConsole=false, const std::string &mutexName=std::string()) | |
Construct a logger object to print on stream and on the standard console, if enableConsole is true (default false). | |
stm::logger::logger (std::ostream &stream, std::ostream &console, const std::string &mutexName=std::string()) | |
Construct a logger object to print on stream and on console. | |
void | stm::logger::setConsole () |
Configure this logger object to print on the standard console. | |
stm::wlogger::wlogger (bool enableStream, const std::string &mutexName) | |
Construct a logger object to print on stream (default the standard console), if enableStream is true. | |
stm::wlogger::wlogger (std::ostream &stream, const std::string &mutexName) | |
Construct a logger object to print on stream. | |
stm::wlogger::wlogger (std::wostream &stream, bool enableConsole=false, const std::string &mutexName=std::string()) | |
Construct a wlogger object to print on stream and on the standard console, if enableConsole is true (default false). | |
stm::wlogger::wlogger (std::wostream &stream, std::wostream &console, const std::string &mutexName=std::string()) | |
Construct a wlogger object to print on stream and on console. | |
void | stm::wlogger::setConsole () |
Configure this wlogger object to print on the standard console. |
typedef basic_logger< StringT, stdIndent, lineLength, lockingPolicy > stm::basic_logger< StringT, stdIndent, lineLength, lockingPolicy >::logger_type [inherited] |
typedef StringT stm::basic_logger< StringT, stdIndent, lineLength, lockingPolicy >::string_type [inherited] |
String type.
Shall be a specialization of std::basic_string.
Definition at line 191 of file loggeraids.hpp.
typedef std::basic_ostream< typename string_type::value_type, typename string_type::traits_type > stm::basic_logger< StringT, stdIndent, lineLength, lockingPolicy >::ostream_type [inherited] |
typedef impl::char_type stm::basic_logger< StringT, stdIndent, lineLength, lockingPolicy >::char_type [inherited] |
Character type.
The same as string_type::value_type and ostream_type::char_type.
Definition at line 205 of file loggeraids.hpp.
anonymous enum [inherited] |
StdIndent | Standard indentation. |
LineLength | Standard line length. |
LockingPolicy | Locking policy. |
Definition at line 207 of file loggeraids.hpp.
enum stm::basic_logger::FmtFlags [inherited] |
Format information flags.
These flag values may be bitwise ored and also combined with the syslog level flags of stm::SyslogFlags.
NoFlag |
No flag.
Oring this value has no effect. |
Indent |
Indentation flag causes the string to be output to be formatted using indentation of the contiuation lines.
This flag is set imlicitly, if another flag except NoFlag, a syslog level flag or Single is set. |
NoPara | No paragraph flag. |
KeepWs | Keep white space flag. |
AutoInd | Auto indentation flag. |
ColonInd | Colon indentation flag. |
ColonTable | Colon table flag. |
RiJust | Right justification flag. |
RawPath | Raw path flag. |
Single | Single stream flag. |
Definition at line 218 of file loggeraids.hpp.
stm::basic_logger< StringT, stdIndent, lineLength, lockingPolicy >::Fmt::Fmt | ( | word | flags, | |
word | indent = StdIndent , |
|||
word | length = LineLength | |||
) | [inherited] |
Constructs an object with format information flags, indent and length.
stm::basic_logger< StringT, stdIndent, lineLength, lockingPolicy >::locker::locker | ( | const logger_type & | logger | ) | [inherited] |
Construct a scoped lock for logger.
stm::basic_logger< StringT, stdIndent, lineLength, lockingPolicy >::locker::~locker | ( | ) | [inherited] |
Destructor.
stm::basic_logger< StringT, stdIndent, lineLength, lockingPolicy >::basic_logger | ( | const std::string & | mutexName = std::string() |
) | [inherited] |
Default constructor for a basic_logger object not to print.
mutexName is the name of the mutex used for system-wide locking, if applicable. If for system-wide locking mutexName is empty, the standard name 'StmLoggerLock' is used.
stm::basic_logger< StringT, stdIndent, lineLength, lockingPolicy >::basic_logger | ( | const logger_type & | other | ) | [inherited] |
Copy constructor.
stm::basic_logger< StringT, stdIndent, lineLength, lockingPolicy >::basic_logger | ( | ostream_type & | stream, | |
const std::string & | mutexName = std::string() | |||
) | [inherited] |
Construct a basic_logger object to print on stream.
mutexName is the name of the mutex used for system-wide locking, if applicable. If for system-wide locking mutexName is empty, the standard name 'StmLoggerLock' is used.
stm::basic_logger< StringT, stdIndent, lineLength, lockingPolicy >::basic_logger | ( | ostream_type & | stream, | |
ostream_type & | console, | |||
const std::string & | mutexName = std::string() | |||
) | [inherited] |
Construct a basic_logger object to print on stream and on console.
mutexName is the name of the mutex used for system-wide locking, if applicable. If for system-wide locking mutexName is empty, the standard name 'StmLoggerLock' is used.
stm::basic_logger< StringT, stdIndent, lineLength, lockingPolicy >::~basic_logger | ( | ) | [inherited] |
Destroy a basic_logger object.
bool stm::basic_logger< StringT, stdIndent, lineLength, lockingPolicy >::hasStream | ( | ) | const [inherited] |
Return true, if this basic_logger object has a stream, else false.
void stm::basic_logger< StringT, stdIndent, lineLength, lockingPolicy >::setStream | ( | ostream_type & | stream | ) | [inherited] |
Configure this basic_logger object to print on stream.
void stm::basic_logger< StringT, stdIndent, lineLength, lockingPolicy >::unsetStream | ( | ) | [inherited] |
Configure this basic_logger object to print on no stream.
bool stm::basic_logger< StringT, stdIndent, lineLength, lockingPolicy >::hasConsole | ( | ) | const [inherited] |
Return true, if this basic_logger object has a console, else false.
void stm::basic_logger< StringT, stdIndent, lineLength, lockingPolicy >::setConsole | ( | ostream_type & | console | ) | [inherited] |
Configure this basic_logger object to print on console.
void stm::basic_logger< StringT, stdIndent, lineLength, lockingPolicy >::unsetConsole | ( | ) | [inherited] |
Configure this basic_logger object to print on no console.
int stm::basic_logger< StringT, stdIndent, lineLength, lockingPolicy >::adjustChild | ( | ) | [inherited] |
Adjust this basic_logger object after a call to fork().
This method is intended to be called after a fork system call by the child process in order to adjust the reference count of the named mutex used to implement system-wide locking. Returns 0
on success, else -1
with errno
set appropriately.
int stm::basic_logger< StringT, stdIndent, lineLength, lockingPolicy >::operator() | ( | Fmt | streamFmt = Fmt() , |
|
Fmt | consoleFmt = Fmt() | |||
) | [inherited] |
Print the contents of the string stream base of this basic_logger to the streams configured and then clear it.
For printing on the stream streamFmt and for printing on the console consoleFmt is used as format information. If one of the Fmt objects has a syslog level defined (see stm::SyslogFlags) in its flags member, the content is also printed to the system log (see stm::syslog()). The operation is ended on the first error occurred in which case a negative value is returned, or else the number of characters written to the last stream configured not counting trailing white space. If no stream is configured, 0 is returned.
int stm::basic_logger< StringT, stdIndent, lineLength, lockingPolicy >::underline | ( | int | n, | |
char_type | ch = char_type('=') , |
|||
dword | nl = 1 | |||
) | [inherited] |
Print character ch (default '=') n times to the streams configured, followed by nl times (default 1) the newline character.
The operation is ended on the first error occurred in which case -1 is returned, or else n. Also, if no stream is configured, n is returned.
int stm::basic_logger< StringT, stdIndent, lineLength, lockingPolicy >::paragraph | ( | dword | nl = 1 |
) | [inherited] |
Print on each configured stream as much newlines that at least nl empty lines are present after the last recently printed non empty line.
The operation is ended on the first error occurred in which case a negative value is returned, or else the number of newlines written to the last stream configured. If no stream is configured, 0 is returned.
static string_type stm::basic_logger< StringT, stdIndent, lineLength, lockingPolicy >::mkPath | ( | const string_type & | str | ) | [static, inherited] |
Return a copy of str, if str does not contain white space, else str quoted by '"' characters.
stm::logger< stdIndent, lineLength, errorConsole, lockingPolicy >::logger | ( | bool | enableStream, | |
const std::string & | mutexName | |||
) | [inherited] |
Construct a logger object to print on stream (default the standard console), if enableStream is true.
mutexName is the name of the mutex used for system-wide locking, if applicable. If for system-wide locking mutexName is empty, the standard name 'StmLoggerLock' is used.
stm::logger< stdIndent, lineLength, errorConsole, lockingPolicy >::logger | ( | std::ostream & | stream, | |
const std::string & | mutexName | |||
) | [inherited] |
Construct a logger object to print on stream.
mutexName is the name of the mutex used for system-wide locking, if applicable. If for system-wide locking mutexName is empty, the standard name 'StmLoggerLock' is used.
stm::logger< stdIndent, lineLength, errorConsole, lockingPolicy >::logger | ( | std::ostream & | stream, | |
bool | enableConsole = false , |
|||
const std::string & | mutexName = std::string() | |||
) | [inherited] |
Construct a logger object to print on stream and on the standard console, if enableConsole is true (default false).
mutexName is the name of the mutex used for system-wide locking, if applicable. If for system-wide locking mutexName is empty, the standard name 'StmLoggerLock' is used.
stm::logger< stdIndent, lineLength, errorConsole, lockingPolicy >::logger | ( | std::ostream & | stream, | |
std::ostream & | console, | |||
const std::string & | mutexName = std::string() | |||
) | [inherited] |
Construct a logger object to print on stream and on console.
mutexName is the name of the mutex used for system-wide locking, if applicable. If for system-wide locking mutexName is empty, the standard name 'StmLoggerLock' is used.
void stm::logger< stdIndent, lineLength, errorConsole, lockingPolicy >::setConsole | ( | ) | [inherited] |
Configure this logger object to print on the standard console.
stm::wlogger< stdIndent, lineLength, errorConsole, lockingPolicy >::wlogger | ( | bool | enableStream, | |
const std::string & | mutexName | |||
) | [inherited] |
Construct a logger object to print on stream (default the standard console), if enableStream is true.
mutexName is the name of the mutex used for system-wide locking, if applicable. If for system-wide locking mutexName is empty, the standard name 'StmLoggerLock' is used.
stm::wlogger< stdIndent, lineLength, errorConsole, lockingPolicy >::wlogger | ( | std::ostream & | stream, | |
const std::string & | mutexName | |||
) | [inherited] |
Construct a logger object to print on stream.
mutexName is the name of the mutex used for system-wide locking, if applicable. If for system-wide locking mutexName is empty, the standard name 'StmLoggerLock' is used.
stm::wlogger< stdIndent, lineLength, errorConsole, lockingPolicy >::wlogger | ( | std::wostream & | stream, | |
bool | enableConsole = false , |
|||
const std::string & | mutexName = std::string() | |||
) | [inherited] |
Construct a wlogger object to print on stream and on the standard console, if enableConsole is true (default false).
mutexName is the name of the mutex used for system-wide locking, if applicable. If for system-wide locking mutexName is empty, the standard name 'StmLoggerLock' is used.
stm::wlogger< stdIndent, lineLength, errorConsole, lockingPolicy >::wlogger | ( | std::wostream & | stream, | |
std::wostream & | console, | |||
const std::string & | mutexName = std::string() | |||
) | [inherited] |
Construct a wlogger object to print on stream and on console.
mutexName is the name of the mutex used for system-wide locking, if applicable. If for system-wide locking mutexName is empty, the standard name 'StmLoggerLock' is used.
void stm::wlogger< stdIndent, lineLength, errorConsole, lockingPolicy >::setConsole | ( | ) | [inherited] |
Configure this wlogger object to print on the standard console.
© Copyright Tom Michaelis 2002-2007
Distributed under the SysToMath Software License (See the accompanying file license.txt or a copy at www.SysToMath.com).