A customised textstream for fast, multithreaded logging to file. More...
|Disables header information. More...|
|void||disableMode (int mode)|
|Disable the given log mode. More...|
|Disable time stamps. More...|
|Enable header information. More...|
|void||enableMode (int mode, const std::string header="")|
|Enable the given mode and associate the specified header. More...|
|Enable time stamps. More...|
|Check to see if any modes are enabled. More...|
|bool||isModeEnabled (int mode)|
|Check to see if a particular mode is enabled. More...|
|LogStream &||log (int mode)|
|Log streaming function. More...|
|Default constructor, underlying device must be manually opened. More...|
|LogStream (const std::string &file_name, const WriteMode &mode=New)|
|Convenience constructor for logstreams. More...|
|Public Member Functions inherited from ecl::TextStream< SharedFile >|
|std::map< int, std::string >||modes|
A customised textstream for fast, multithreaded logging to file.
Together with the LOG and FLUSH macros, this class enables fast, multithreaded logging with multiple modes, customisable headers and timestamps.
Multiple modes are most conveniently utilsed via customised enums. For example:
Note that this is an advantage over alot of other loggers in that it gives you the freedom to define your own error logging levels. Each mode can then be associated inside the log stream with its own customised header.
This process can be repeated from multiple threads each with its own instance of the log stream attached to the single file. Using the log stream is then done via the macros LOG and FLUSH
By default this will automatically add header and timestamp information. You can manually disable these if you prefer.
Convenience constructor for logstreams.
This constructor enables RAII style construction of the underlying shared file device.
|file_name||: output file name.|
|mode||: mode for writing (New, Append).|
|StandardException||: throws if the connection failed to open.|
|const std::string||header =
|LogStream & ecl::LogStream::log||(||int||mode||)|
Log streaming function.
Do not use this directly, rather it is indirectly utilised by the LOG macro, which should only reach here once isModeEnabled() is checked. It adds a header and timestamp if it is configured to do so and then passes the stream to the program for further additions.
|mode||: log mode that is being logged.|