Log
Inherited: None
Description
The Log is used whenever the developer needs to write out debugging or tracing information to a file or console.
Common usecase:
Log(Log::ERR) << "Loading level:" << 1;
Public Methods
Log (Log::LogTypes type) |
|
~Log () |
|
Log & |
operator (bool b) |
Log & |
operator (char c) |
Log & |
operator (const char * string) |
Log & |
operator (const std::string & string) |
Log & |
operator (const void * value) |
Log & |
operator (double d) |
Log & |
operator (float f) |
Log & |
operator (int i) |
Log & |
operator (long long i) |
Log & |
operator (short s) |
Log & |
operator (unsigned char c) |
Log & |
operator (unsigned int i) |
Log & |
operator (unsigned long long i) |
Log & |
operator (unsigned short s) |
Public Enums
enum Log::LogTypes
This enum defines the lavel of logging.
Constant |
Value |
Description |
Log::CRT |
0 |
Critical logging. For use with critical failures. |
Log::ERR |
1 |
Error logging. For use with unrecoverable failures. |
Log::WRN |
2 |
Warning logging. For use with recoverable failures. |
Log::INF |
3 |
Informational logging. Should be desabled in release. |
Log::DBG |
4 |
Debug logging. Should be desabled in release. |
Static Methods
LogHandler * |
handler () |
void |
overrideHandler (LogHandler * handler) |
void |
setLogLevel (Log::LogTypes level) |
Methods Description
Log::Log (Log::LogTypes type)
Constructs a log stream that writes to the handler for the message type.
Log::~Log ()
Flushes any pending data to be written and destroys the log stream.
LogHandler * Log::handler ()
Returns LogHandler object if present; otherwise returns nullptr.
void Log::overrideHandler (LogHandler * handler)
Set a new Log handler. This method can be used in case if a developer would need to move logging stream to someplace. For example to the console.
void Log::setLogLevel (Log::LogTypes level)
Set current log level output. Messages wich are below this level will be descarded.
Log & Log::operator<< (bool b)
Writes the b*oolean value, *b, to the stream and returns a reference to the stream.
Log & Log::operator<< (char c)
Writes the singed 8 bit integer value, c, to the stream and returns a reference to the stream.
Log & Log::operator<< (char * string)
Writes the ‘0’-terminated string, to the stream and returns a reference to the stream.
Log & Log::operator<< (std::string & string)
Writes the text string, to the stream and returns a reference to the stream.
Log & Log::operator<< (void * value)
Writes the pointer value, to the stream and returns a reference to the stream.
Log & Log::operator<< (double d)
Writes the float value with d*ouble precision, *d, to the stream and returns a reference to the stream.
Log & Log::operator<< (float f)
Writes the f*loat value, *f, to the stream and returns a reference to the stream.
Log & Log::operator<< (int i)
Writes the singed 32 bit i*nteger value, *i, to the stream and returns a reference to the stream.
Log & Log::operator<< (long i)
Writes the singed 64 bit i*nteger value, *i, to the stream and returns a reference to the stream.
Log & Log::operator<< (short s)
Writes the s*inged 16 bit integer value, *s, to the *s*tream and returns a reference to the *s*tream.
Log & Log::operator<< (char c)
Writes the unsinged 8 bit integer value, c, to the stream and returns a reference to the stream.
Log & Log::operator<< (int i)
Writes the unsinged 32 bit i*nteger value, *i, to the stream and returns a reference to the stream.
Log & Log::operator<< (long i)
Writes the unsinged 64 bit i*nteger value, *i, to the stream and returns a reference to the stream.
Log & Log::operator<< (short s)
Writes the unsinged 16 bit integer value, s, to the *s*tream and returns a reference to the *s*tream.