Class for printing out messages to console, file, virtual method and or a callback function.
More...
#include <LogStream.h>
Class for printing out messages to console, file, virtual method and or a callback function.
Definition at line 44 of file LogStream.h.
◆ CallbackFunction_t
| typedef void(* agx::LogStream::CallbackFunction_t) (const char *, unsigned int) |
◆ OutputMode
Enums used to specify the output mode used. These can be OR:ed together.
| Enumerator |
|---|
| CERR | |
| COUT | |
| FILE | |
| FUNCTION | |
Definition at line 85 of file LogStream.h.
◆ LogStream() [1/2]
| agx::LogStream::LogStream |
( |
| ) |
|
◆ ~LogStream()
| virtual agx::LogStream::~LogStream |
( |
| ) |
|
|
virtual |
Flush and empty all buffers, and then remove the allocated buffers.
◆ LogStream() [2/2]
| agx::LogStream::LogStream |
( |
const LogStream & |
| ) |
|
|
protected |
◆ appendOutputMode()
| void agx::LogStream::appendOutputMode |
( |
short |
modemask | ) |
|
OR:s together the active outputmode with modemask.
◆ clearOutputMode()
| void agx::LogStream::clearOutputMode |
( |
void |
| ) |
|
Resets the active output modes to none.
◆ close()
| void agx::LogStream::close |
( |
void |
| ) |
|
◆ flush()
| void agx::LogStream::flush |
( |
| ) |
|
◆ getCallback()
◆ getDateFormat()
| const agx::String & agx::LogStream::getDateFormat |
( |
| ) |
const |
- Returns
- the date format used for specifying the output format of the getTimeString()
◆ getEnableDate()
| bool agx::LogStream::getEnableDate |
( |
| ) |
const |
◆ getEnableThreadId()
| bool agx::LogStream::getEnableThreadId |
( |
| ) |
const |
◆ getFilename()
◆ getOutputMode()
| int agx::LogStream::getOutputMode |
( |
void |
| ) |
|
Returns the active outputmode.
◆ getTimeString()
| static agx::String agx::LogStream::getTimeString |
( |
const agx::String & |
dateFormat = "", |
|
|
bool |
logTimeWithMilliseconds = true |
|
) |
| |
|
static |
- Parameters
-
| dateFormat | - Format in date (if logTimeWithMilliseconds==false) as being used by the method strftime() |
| logTimeWithMilliseconds | - If true (default) the date string will be reported in milliseconds |
- Returns
- the current time in the specified time format
◆ haveOpenFile()
| bool agx::LogStream::haveOpenFile |
( |
| ) |
const |
- Returns
- true if a file is open
◆ isActive()
| bool agx::LogStream::isActive |
( |
OutputMode |
modemask | ) |
|
Returns true if the modemask is set as the active output mode.
◆ message()
| virtual void agx::LogStream::message |
( |
const char * |
msg, |
|
|
unsigned int |
length |
|
) |
| |
|
virtual |
This method will be called whenever there is a message ready for output.
Derive from this class and implement this method.
◆ open()
Open a specified file as a log.
◆ operator=()
◆ setCallback()
Sets the function that will be called if FUNCTION is set as outputmode.
◆ setDateFormat()
| void agx::LogStream::setDateFormat |
( |
const agx::String & |
date_format | ) |
|
Specify the format of the date/time string that getTimeString() will return Look at strftime for examples of how to specify the date.
Default is "%X" (hh:mm:ss)
◆ setEnableDate()
| void agx::LogStream::setEnableDate |
( |
bool |
flag | ) |
|
If flag == true, the date in the specified date format will be added prior to each message.
◆ setEnableThreadId()
| void agx::LogStream::setEnableThreadId |
( |
bool |
flag | ) |
|
If set to true, the messages will be prefixed with the id of the thread that generates the message.
◆ setOutputMode()
| void agx::LogStream::setOutputMode |
( |
short |
modemask | ) |
|
Set the active outputmode to modemask.
◆ write()
| size_t agx::LogStream::write |
( |
const char * |
msg, |
|
|
std::streamsize |
count |
|
) |
| |
|
protected |
◆ m_callback
◆ m_file
| ::FILE* agx::LogStream::m_file |
|
protected |
◆ m_filename
◆ m_isOpen
| bool agx::LogStream::m_isOpen |
|
protected |
◆ m_mode
| int agx::LogStream::m_mode |
|
protected |
The documentation for this class was generated from the following file: