Description
Base class for output of errors, messages, warnings, etc.
(logging class). Must be specialized for specific output, for example output to console, to windows, etc. by inheriting custom classes. See below, an example for logging to std::cout
#include <ChLog.h>
Public Types | |
enum | eChLogLevel { CHERROR = 0, CHWARNING, CHMESSAGE, CHSTATUS, CHQUIET } |
There are different levels of log messages. More... | |
Public Types inherited from chrono::ChStream | |
enum | eChMode { CHFILE_NORMAL = 0, CHFILE_NOWRITE, CHFILE_SAFEWRITE, CHFILE_OPENLATER } |
[Obsolete] Modes for chrono files (the ch-modes). More... | |
enum | eChStreamError { CHSTREAM_OK = 0, CHSTREAM_EOF, CHSTREAM_FAIL } |
Errors for chrono files (the ch-modes). More... | |
Public Member Functions | |
virtual void | Flush () |
Forces output of message buffers, if any. More... | |
void | SetDefaultLevel (eChLogLevel mlev) |
Sets the default level, to be used from now on. | |
void | SetCurrentLevel (eChLogLevel mlev) |
Sets the current level, to be used until new flushing. | |
eChLogLevel | GetCurrentLevel () |
Gets the current level. | |
void | RestoreDefaultLevel () |
Restore the default level. | |
ChLog & | operator- (eChLogLevel mnewlev) |
Using the - operator is easy to set the status of the log, so in you code you can write, for example: GetLog() - ChLog::CHERROR << "a big error in " << mynumber << " items \n" ;. | |
Public Member Functions inherited from chrono::ChStreamOutAscii | |
ChStreamOutAscii & | operator<< (bool bVal) |
Generic << operator for all classes which implement serialization by means of a method named 'void StreamOut(ChStreamOutAscii&)'. | |
ChStreamOutAscii & | operator<< (char tch) |
ChStreamOutAscii & | operator<< (const int nVal) |
ChStreamOutAscii & | operator<< (const double dVal) |
ChStreamOutAscii & | operator<< (const float fVal) |
ChStreamOutAscii & | operator<< (unsigned int unVal) |
ChStreamOutAscii & | operator<< (char *str) |
ChStreamOutAscii & | operator<< (const char *str) |
ChStreamOutAscii & | operator<< (const std::string &str) |
ChStreamOutAscii & | operator<< (unsigned long unVal) |
ChStreamOutAscii & | operator<< (unsigned long long unVal) |
template<class T > | |
ChStreamOutAscii & | operator< (T obj) |
OBSOLETE use ChArchive << operator and ArchiveOut() | |
virtual void | Format (char *formatString,...) |
Output the log message in form of a formatted string, like in printf(). | |
void | SetNumFormat (const char *mf) |
Set the formatting string (ex "%f" or "%g" etc.) for float->text conversion. | |
char * | GetNumFormat () |
void | SetCommentTrailer (char *mt) |
Set the trailer symbol before each comment (example: "#" , or "//"). | |
void | CR () |
Outputs carriage return. | |
void | TAB () |
Output tab. | |
void | Comment (char m_string[]) |
Output comment with preceding trailer (e.g., #). | |
void | Bar () |
Output a separation bar in ASCII file. | |
Protected Member Functions | |
ChLog () | |
Creates the ChLog, and sets the level at MESSAGE. | |
Protected Member Functions inherited from chrono::ChStreamOut | |
virtual void | Output (const char *data, size_t n)=0 |
Outputs a raw chunk of data, from pointer 'data' up to 'n' chars (bytes). More... | |
Protected Attributes | |
eChLogLevel | current_level |
eChLogLevel | default_level |
Protected Attributes inherited from chrono::ChStreamOutAscii | |
char | number_format [10] |
char | comment_trailer [10] |
Member Enumeration Documentation
◆ eChLogLevel
There are different levels of log messages.
This is indifferent for the base class, but more sophisticated specializations of the ChLog class may handle message output in different ways (for example a ChLogForGUIapplication may print logs in STATUS level only to the bottom of the window, etc.)
Member Function Documentation
◆ Flush()
|
inlinevirtual |
Forces output of message buffers, if any.
Also, should restore the default eChLogLevel This base class does pretty nothing, but inherited classes should override this method with more specific implementations.
The documentation for this class was generated from the following files:
- /builds/uwsbel/chrono/src/chrono/core/ChLog.h
- /builds/uwsbel/chrono/src/chrono/core/ChLog.cpp