Log system class.
More...
#include <Log.h>
List of all members.
Detailed Description
Log system class.
- Note:
- A configurable amount of messages is hold in a queue (the last n-messages)
- When the queue is full a flush is done
- A flush is also done if a specified log level is used in the output function (configurable)
- A specified log level includes also all log levels with lower values e.g.: if the overall log level is set to info, log messages marked as warning, error or critical are written to the log, too
- You can define as many debug log levels as you want
- Implementation of the strategy design pattern, this class is the context
Member Enumeration Documentation
Log levels.
- Enumerator:
Quiet |
No log outputs
|
Always |
Should be used if the message should be logged always
|
Critical |
Should be used if an critical error occurs
|
Error |
Should be used if an error occurs
|
Warning |
Should be used for warning texts
|
Info |
Should be used for info texts
|
Debug |
Should be used for debug level texts
|
Member Function Documentation
Get verbose mode (write log entries to console)
- Returns:
- 'true' if the log is writing into the console, else 'false'
- Note:
- In addition to using an optional log formatter, the log also writes into the console in verbose mode
- The log does not need be to be opened to write into the console
- Android: Messages are not written into the console, instead the Android in-kernel log buffer is used (use Androids "logcat" utility to access this system log)
- By default the log does not write into the console
Set verbose mode (write log entries to console)
- Parameters:
-
[in] | bVerbose | 'true' if the log is writing into the console, else 'false' |
[in] | bVerboseLogLevelPrefix | Should the [LogLevel] prefix be shown? |
- See also:
-
Open the log file by using a filename.
- Parameters:
-
[in] | sFilename | The log's filename, the log formatter is automatically created by using the filename extension |
- Returns:
- 'true' if all went fine, else 'false' (maybe the log is already opened or the filename extension is not supported?)
- Note:
-
Open the log file by using a filename and an explicit log formatter instance.
- Parameters:
-
[in] | sFilename | The log's filename |
[in] | cLogFormatter | Log formatter instance to be used, if this method returns successfully, the log takes over the control and is responsible for the destruction of the given instance |
- Returns:
- 'true' if all went fine, else 'false' (maybe the log is already opened?)
Close log.
- Returns:
- 'true' if all went fine, else 'false'
Get log filename.
- Returns:
- The log filename
Write a string into the log.
- Parameters:
-
[in] | nLogLevel | Log level |
[in] | sText | Text which should be written into the log |
- Returns:
- 'true' if all went fine, else 'false'
Get current log level.
- Returns:
- The current log level
Set current log level.
- Parameters:
-
[in] | nLogLevel | New current log level |
Get log level for automatic flush.
- Returns:
- Log level for explicitly flush
Set log level for automatic flush.
- Parameters:
-
[in] | nFlushLogLevel | Log level for the explicitly flush |
Flush output buffer to disk.
- Returns:
- 'true' if all went fine, else 'false' (maybe there was nothing to flush?)
- Note:
- Only call this function if really required!
Get current amount of buffered log messages.
- Returns:
- Amount of buffered log messages
Set how many log messages should be buffered in memory.
- Parameters:
-
[in] | nBufferCount | Number of messages to buffer |
- Note:
- The nBufferCount-last log messages gets buffered
Get a copy of the queue which holds the last log messages.
- Returns:
- Queue of n-last log messages
Get a string representation of the given log level.
- Parameters:
-
[in] | nLogLevel | Log level to return the string representation from |
- Returns:
- The string representation of the given log level
Get log formatter.
Get current log formatter.
- Returns:
- The current log formatter object, can be a null pointer, do NOT delete the returned instance!
The documentation for this class was generated from the following files: