ldas-tools-al
2.6.3
|
Logging class. More...
#include <Log.hh>
Inherits LDASTools::AL::Thread, LDASTools::AL::Thread, and LDASTools::AL::Thread.
Classes | |
struct | message_queue_entry_type |
Information about a log message. More... | |
class | StreamCBInterface |
Class to handle stream callbacks. More... | |
class | StreamInterface |
Class to handle streaming of messages. More... | |
Public Types | |
typedef int | group_type |
Type for group. More... | |
typedef boost::shared_ptr< StreamInterface > | stream_type |
typedef int | level_type |
Type for level. More... | |
typedef int | group_type |
Type for group. More... | |
typedef boost::shared_ptr< StreamInterface > | stream_type |
typedef int | level_type |
Type for level. More... | |
typedef int | group_type |
Type for group. More... | |
typedef boost::shared_ptr< StreamInterface > | stream_type |
typedef int | level_type |
Type for level. More... | |
Public Member Functions | |
Log (const std::string &BaseName) | |
Constructor. More... | |
~Log () | |
Destructor. | |
void | Message (const group_type Group, const level_type Level, const std::string &Message) |
Send a message to the log. More... | |
void | Stream (stream_type Output) |
Set the stream to use for output. More... | |
void | Verbosity (const group_type Group, const level_type Level) |
Establish logging level for a given group. More... | |
bool | VerbosityCheck (const group_type Group, const level_type Level) const |
Check if the message will be logged. More... | |
void | EntriesMax (int Value) |
Specify the maximum number of entries per file. More... | |
Log (const std::string &BaseName) | |
Constructor. More... | |
~Log () | |
Destructor. | |
void | Message (const group_type Group, const level_type Level, const std::string &Message) |
Send a message to the log. More... | |
void | Stream (stream_type Output) |
Set the stream to use for output. More... | |
void | Verbosity (const group_type Group, const level_type Level) |
Establish logging level for a given group. More... | |
bool | VerbosityCheck (const group_type Group, const level_type Level) const |
Check if the message will be logged. More... | |
void | EntriesMax (int Value) |
Specify the maximum number of entries per file. More... | |
Log (const std::string &BaseName) | |
Constructor. More... | |
~Log () | |
Destructor. | |
void | Message (const group_type Group, const level_type Level, const std::string &Message) |
Send a message to the log. More... | |
void | Stream (stream_type Output) |
Set the stream to use for output. More... | |
void | Verbosity (const group_type Group, const level_type Level) |
Establish logging level for a given group. More... | |
bool | VerbosityCheck (const group_type Group, const level_type Level) const |
Check if the message will be logged. More... | |
void | EntriesMax (int Value) |
Specify the maximum number of entries per file. More... | |
void | CancellationCheck (const std::string &Header, const char *File, const int Line) const |
Deliver pending cancellation requests to the calling thread. More... | |
void | CancellationCheck (const std::string &Header, const char *File, const int Line) const |
Deliver pending cancellation requests to the calling thread. More... | |
void | CancellationCheck (const std::string &Header, const char *File, const int Line) const |
Deliver pending cancellation requests to the calling thread. More... | |
cancel_type | CancellationType (signal_type &Signal) const |
Return the type of cancellation. More... | |
void | CancellationType (cancel_type Type, signal_type Signal=SignalHandler::SIGNAL_UNKNOWN) |
Establiosh the type of cancellation. More... | |
cancel_type | CancellationType (signal_type &Signal) const |
Return the type of cancellation. More... | |
void | CancellationType (cancel_type Type, signal_type Signal=SignalHandler::SIGNAL_UNKNOWN) |
Establiosh the type of cancellation. More... | |
cancel_type | CancellationType (signal_type &Signal) const |
Return the type of cancellation. More... | |
void | CancellationType (cancel_type Type, signal_type Signal=SignalHandler::SIGNAL_UNKNOWN) |
Establiosh the type of cancellation. More... | |
bool | IsCancelled () const |
Return the cancellation state of the thread. More... | |
bool | IsCancelled () const |
Return the cancellation state of the thread. More... | |
bool | IsCancelled () const |
Return the cancellation state of the thread. More... | |
bool | IsDetached () const |
Reports detached state. More... | |
bool | IsDetached () const |
Reports detached state. More... | |
bool | IsDetached () const |
Reports detached state. More... | |
thread_type | ParentThread () const |
Retrieve key for parent thread. | |
thread_type | ParentThread () const |
Retrieve key for parent thread. | |
thread_type | ParentThread () const |
Retrieve key for parent thread. | |
Static Public Member Functions | |
static void | StackSizeDefault (size_t StackSize) |
Protected Member Functions | |
virtual void | onStreamClose () |
Hook to do additional action when the stream is closed. More... | |
virtual void | onStreamOpen () |
Hook to do additional action when the stream is opened. More... | |
void | purge () |
Flush the output queue. More... | |
virtual void | onStreamClose () |
Hook to do additional action when the stream is closed. | |
virtual void | onStreamOpen () |
Hook to do additional action when the stream is opened. | |
void | purge () |
Flush the output queue. | |
virtual void | onStreamClose () |
Hook to do additional action when the stream is closed. | |
virtual void | onStreamOpen () |
Hook to do additional action when the stream is opened. | |
void | purge () |
Flush the output queue. | |
int | spawn (start_function_type StartFunction=(start_function_type) start_routine) |
Spawn a new thread. More... | |
int | spawn (start_function_type StartFunction=(start_function_type) start_routine) |
Spawn a new thread. More... | |
int | spawn (start_function_type StartFunction=(start_function_type) start_routine) |
Spawn a new thread. More... | |
Static Protected Member Functions | |
static void | cancelCleanup (Thread *Source) |
Perform cleanup of a cancelled thread. More... | |
static void | cancelCleanup (Thread *Source) |
Perform cleanup of a cancelled thread. More... | |
static void | cancelCleanup (Thread *Source) |
Perform cleanup of a cancelled thread. More... | |
Protected Attributes | |
stream_type | m_stream |
Active output stream. | |
Logging class.
This is a very simple logging class that is thread safe. It does support seperate debugging levels for each group.
typedef int LDASTools::AL::Log::group_type |
Type for group.
This is the data type used when referencing parameters representing the group associated with the message.
typedef int LDASTools::AL::Log::group_type |
Type for group.
This is the data type used when referencing parameters representing the group associated with the message.
typedef int LDASTools::AL::Log::group_type |
Type for group.
This is the data type used when referencing parameters representing the group associated with the message.
typedef int LDASTools::AL::Log::level_type |
Type for level.
This is the data type used when referencing parameters representing the level of message.
typedef int LDASTools::AL::Log::level_type |
Type for level.
This is the data type used when referencing parameters representing the level of message.
typedef int LDASTools::AL::Log::level_type |
Type for level.
This is the data type used when referencing parameters representing the level of message.
typedef boost::shared_ptr< StreamInterface > LDASTools::AL::Log::stream_type |
The stream_type is used to represent the output stream class used to log the messages.
typedef boost::shared_ptr< StreamInterface > LDASTools::AL::Log::stream_type |
The stream_type is used to represent the output stream class used to log the messages.
typedef boost::shared_ptr< StreamInterface > LDASTools::AL::Log::stream_type |
The stream_type is used to represent the output stream class used to log the messages.
LDASTools::AL::Log::Log | ( | const std::string & | BaseName | ) |
Constructor.
[in] | BaseName | The base name to be used for creation of the log file. |
Constructor for the Log class. This will save the base name to use for the log file and start the writing thread.
This class works by seperating the request to log a message and the actual writing of the message. This seperation allows for multiple threads to log messages asyncronously while minimizing the serialization caused by critical resources being locked.
LDASTools::AL::Log::Log | ( | const std::string & | BaseName | ) |
Constructor.
[in] | BaseName | The base name to be used for creation of the log file. |
LDASTools::AL::Log::Log | ( | const std::string & | BaseName | ) |
Constructor.
[in] | BaseName | The base name to be used for creation of the log file. |
|
staticprotectedinherited |
Perform cleanup of a cancelled thread.
[in] | Source | The thread being cancelled. |
|
staticprotectedinherited |
Perform cleanup of a cancelled thread.
[in] | Source | The thread being cancelled. |
|
staticprotectedinherited |
Perform cleanup of a cancelled thread.
[in] | Source | The thread being cancelled. |
|
inherited |
Deliver pending cancellation requests to the calling thread.
[in] | Header | Description of the method from which the request was made |
[in] | File | Filename from where the request was made. |
[in] | Line | Line number in Filename from where the request was made. |
Deliver any pending cancellation requests to the calling thread. If cancellation is to be done via exception, then a cancellation exception is throw. If not, then a call to the appropriate thread library's cancellation routine is made.
|
inherited |
Deliver pending cancellation requests to the calling thread.
[in] | Header | Description of the method from which the request was made |
[in] | File | Filename from where the request was made. |
[in] | Line | Line number in Filename from where the request was made. |
|
inherited |
Deliver pending cancellation requests to the calling thread.
[in] | Header | Description of the method from which the request was made |
[in] | File | Filename from where the request was made. |
[in] | Line | Line number in Filename from where the request was made. |
|
inherited |
Return the type of cancellation.
[out] | Signal | Any auxiliary information associated with the cancellation type |
|
inherited |
Return the type of cancellation.
[out] | Signal | Any auxiliary information associated with the cancellation type |
|
inherited |
Return the type of cancellation.
[out] | Signal | Any auxiliary information associated with the cancellation type |
|
inherited |
Establiosh the type of cancellation.
[in] | Type | The type of cancellation. |
[in] | Signal | Any auxiliary information associated with the cancellation type. |
Sets a how a thread can be cancelled.
|
inherited |
Establiosh the type of cancellation.
[in] | Type | The type of cancellation. |
[in] | Signal | Any auxiliary information associated with the cancellation type. |
|
inherited |
Establiosh the type of cancellation.
[in] | Type | The type of cancellation. |
[in] | Signal | Any auxiliary information associated with the cancellation type. |
void LDASTools::AL::Log::EntriesMax | ( | int | Value | ) |
Specify the maximum number of entries per file.
[in] | Value | The number of entries. |
|
inline |
Specify the maximum number of entries per file.
[in] | Value | The number of entries. |
The Value specified is the maximum number of lines that a file should have before triggering a log rotation request.
void LDASTools::AL::Log::EntriesMax | ( | int | Value | ) |
Specify the maximum number of entries per file.
[in] | Value | The number of entries. |
|
inherited |
Return the cancellation state of the thread.
|
inherited |
Return the cancellation state of the thread.
|
inherited |
Return the cancellation state of the thread.
|
inherited |
Reports detached state.
|
inherited |
Reports detached state.
|
inherited |
Reports detached state.
void LDASTools::AL::Log::Message | ( | const group_type | Group, |
const level_type | Level, | ||
const std::string & | Message | ||
) |
Send a message to the log.
[in] | Group | The group associated with the message. |
[in] | Level | The level associated with the message. |
[in] | Message | The text of the message. |
void LDASTools::AL::Log::Message | ( | const group_type | Group, |
const level_type | Level, | ||
const std::string & | Message | ||
) |
Send a message to the log.
[in] | Group | The group associated with the message. |
[in] | Level | The level associated with the message. |
[in] | Message | The text of the message. |
void LDASTools::AL::Log::Message | ( | const group_type | Group, |
const level_type | Level, | ||
const std::string & | Message | ||
) |
Send a message to the log.
[in] | Group | The group associated with the message. |
[in] | Level | The level associated with the message. |
[in] | Message | The text of the message. |
This member first determins if the Message should be logged based on the Level for the Group. If it should be logged, it will be added to the message queue in a thread safe manner. Another thread is responsible for actually outputting the queue of messages to the log stream.
|
protectedvirtual |
Hook to do additional action when the stream is closed.
By default, there is no special action that needs to take place when the file is closed.
|
protectedvirtual |
Hook to do additional action when the stream is opened.
By default, there is no special action that needs to take place when the file is opened.
|
protected |
Flush the output queue.
Send all output to the open log file.
|
protectedinherited |
Spawn a new thread.
[in] | StartFunction | The routine for the new thread to start. |
|
protectedinherited |
Spawn a new thread.
[in] | StartFunction | The routine for the new thread to start. |
|
protectedinherited |
Spawn a new thread.
[in] | StartFunction | The routine for the new thread to start. |
|
staticinherited |
Establish the default value of the stack size used when creating new threads. This routine does validate the requested value..
void LDASTools::AL::Log::Stream | ( | stream_type | Output | ) |
Set the stream to use for output.
[in] | Output | Stream to use for output |
void LDASTools::AL::Log::Stream | ( | stream_type | Output | ) |
Set the stream to use for output.
[in] | Output | Stream to use for output |
void LDASTools::AL::Log::Stream | ( | stream_type | Output | ) |
Set the stream to use for output.
[in] | Output | Stream to use for output |
|
inline |
Establish logging level for a given group.
[in] | Group | The group for which the logging level is to be modified. |
[in] | Level | The level of debugging to output. |
void LDASTools::AL::Log::Verbosity | ( | const group_type | Group, |
const level_type | Level | ||
) |
Establish logging level for a given group.
[in] | Group | The group for which the logging level is to be modified. |
[in] | Level | The level of debugging to output. |
void LDASTools::AL::Log::Verbosity | ( | const group_type | Group, |
const level_type | Level | ||
) |
Establish logging level for a given group.
[in] | Group | The group for which the logging level is to be modified. |
[in] | Level | The level of debugging to output. |
bool LDASTools::AL::Log::VerbosityCheck | ( | const group_type | Group, |
const level_type | Level | ||
) | const |
Check if the message will be logged.
[in] | Group | The group for which to check. |
[in] | Level | The level to check. |
|
inline |
Check if the message will be logged.
[in] | Group | The group for which to check. |
[in] | Level | The level to check. |
bool LDASTools::AL::Log::VerbosityCheck | ( | const group_type | Group, |
const level_type | Level | ||
) | const |
Check if the message will be logged.
[in] | Group | The group for which to check. |
[in] | Level | The level to check. |