|
| LogStream () |
|
virtual | ~LogStream () |
|
template<typename... T> |
PushResult | push (T &&... args) |
| push a log message to the stream More...
|
|
template<typename T > |
T | getLog (std::string func, unsigned line, std::string name) |
| get a log message from the stream More...
|
|
template<typename T > |
T | getLog (std::string func, std::string msg, std::string name) |
| get a log message from the stream More...
|
|
LogIterator | begin (std::string message="", std::string function_name="", int line=-1) |
|
LogIterator | end () |
|
LogIterator | current (std::string message="", std::string function_name="", int line=-1) |
|
void | flush () |
|
void | setFileLogger (std::string name, DirMode mode1=SINGLE_FILE, DirMode mode2=SINGLE_FILE, DirMode mode3=SINGLE_FILE) |
|
void | setStdoutLogger () |
|
void | setStderrLogger () |
|
void | setFlushAtOnce () |
|
void | setFlushWhenFull () |
|
void | setFlushManually () |
|
void | setAsyncLog () |
|
void | setSyncLog () |
|
FlushMode | getFlushMode () const |
|
void | setFlushMode (FlushMode mode) |
|
LogMode | getLogMode () const |
|
void | setLogMode (LogMode mode) |
|
LogStream is a class to manage the log messages.
LogStream is a class to manage the log messages. It can be used to create log messages and push them to the logger. A default LogStream is created when the first time you call getDefault() function (or first log happens). You can also adjust the way to flush the messages and how the log messages are written to the log file.
template<typename... T>
PushResult zeroerr::LogStream::push |
( |
T &&... |
args | ) |
|
|
inline |
push a log message to the stream
- Template Parameters
-
T | The types of the arguments |
- Parameters
-
- Returns
- PushResult The result of the push
This function is used to push a log message to the stream. You can pass any type of arguments to this function and it will create a log message with the arguments. The log message is not written to the log file until the stream is flushed.
The log message is structured as a tuple of the arguments in the inner implementation class LogMessageImpl. After the log message is created, it used type erasure to return a LogMessage pointer to the caller.
The stored data type is determined by the to_store_type_t<T> template. For all the string type in raw pointer like const char* or char[], it will be converted to std::string. All reference type (including right value reference) will be converted to the original type.