libmoost
|
Initialise the global logging API. More...
#include <global.hpp>
Public Member Functions | |
bool | is_enabled () const |
Check if the logging framework is enabled. | |
bool | is_configured () const |
Check if the logging framework has been configured yet. | |
bool | enable () |
Use default basic configuration. | |
bool | enable (boost::filesystem::path const &filepath, bool use_default=false) |
Use default basic configuration. | |
bool | enable (std::string const &filepath, bool use_default=false) |
Use process name. | |
void | disable () |
Disables the logging framework. | |
void | attach_ostream (std::ostream &out) |
Attach an ostream. | |
void | detach_ostream () |
Detach the ostream. | |
pseudo_ostream & | get_ostream () |
Get a reference to the global pseudo ostream. | |
Private Member Functions | |
global () | |
bool | set_enabled (bool enabled) |
Private Attributes | |
bool | enabled_ |
pseudo_ostream | out_ |
Friends | |
class | moost::utils::singleton_default< T >::friend_type |
Initialise the global logging API.
This class is designed to be a singleton and represents a single point of entry into the initialisation API of the logging framework. Before you can make use of the logging framework you must 'enable' it using one of the enable methods. Once the framework has been enabled there is no additional need to access the global singleton unless you wish to either disable it again or change some of the logging options.
An ostream reference can also be assigned to the global singleton, which will be used to output any status/error information.
Definition at line 84 of file global.hpp.
moost::logging::global::global | ( | ) | [inline, private] |
void moost::logging::global::attach_ostream | ( | std::ostream & | out | ) | [inline] |
Attach an ostream.
If this is set logging debug information will be sent to this stream.
Once the ostream is assigned it MUST remain available for the lifetime of the logger or until 'detatch_ostream' is called. It shall be the responsibility of the consuming application to ensure this is the case.
out | std::ostream reference |
Definition at line 284 of file global.hpp.
void moost::logging::global::detach_ostream | ( | ) | [inline] |
Detach the ostream.
Once called the status/debug ostream associated with the logging framework will be detached and no longer used. After this call it is safe to destroy the ostream.
Definition at line 296 of file global.hpp.
void moost::logging::global::disable | ( | ) | [inline] |
Disables the logging framework.
Definition at line 257 of file global.hpp.
bool moost::logging::global::enable | ( | ) | [inline] |
Use default basic configuration.
Definition at line 130 of file global.hpp.
bool moost::logging::global::enable | ( | boost::filesystem::path const & | filepath, |
bool | use_default = false |
||
) | [inline] |
Use default basic configuration.
Will use the program name and search got logging config, if that can't be found it will either use the default basic configuration or leave configuration in a disabled state.
filepath | to a config file |
use_default | if config cannot be found |
Definition at line 154 of file global.hpp.
bool moost::logging::global::enable | ( | std::string const & | filepath, |
bool | use_default = false |
||
) | [inline] |
Use process name.
Will use the program name and search got logging config, if that can't be found it will either use the default basic configuration or leave configuration in a disabled state.
filepath | to the current program |
use_default | if config cannot be found |
Definition at line 194 of file global.hpp.
pseudo_ostream& moost::logging::global::get_ostream | ( | ) | [inline] |
Get a reference to the global pseudo ostream.
Definition at line 306 of file global.hpp.
bool moost::logging::global::is_configured | ( | ) | const [inline] |
Check if the logging framework has been configured yet.
This differs from is_enabled in so far as the framework may very well be configured but not actually enabled.
Definition at line 119 of file global.hpp.
bool moost::logging::global::is_enabled | ( | ) | const [inline] |
Check if the logging framework is enabled.
This differs from is_configured in so far as the framework may very well be configured but not actually enabled.
Definition at line 106 of file global.hpp.
bool moost::logging::global::set_enabled | ( | bool | enabled | ) | [inline, private] |
Definition at line 312 of file global.hpp.
friend class moost::utils::singleton_default< T >::friend_type [friend] |
Definition at line 86 of file global.hpp.
bool moost::logging::global::enabled_ [private] |
Definition at line 327 of file global.hpp.
pseudo_ostream moost::logging::global::out_ [private] |
Definition at line 328 of file global.hpp.