0.12.0
Freundlich's C++ toolkit
 All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
Public Member Functions
fcppt::log::context Class Reference

Detailed Description

The logger context class is used for finding loggers at runtime.

An object of this class should be declared as static inside a function. This ensures that it is available before every global logger gets constructed. The context object can be passed using fcppt::log::parameters::object::context_location. Logger objects can then later be queried providing their location using this class.

Public Member Functions

 context ()
 Constructs a context with no locations.
 
 ~context ()
 Destroys a context.
 
fcppt::log::optional_object const find (fcppt::log::location const &location) const
 Searches for a logger with a given location.
 
void apply (fcppt::log::location const &location, fcppt::log::tree_function const &function)
 Applies a function to all logers given a location recursively.
 

Constructor & Destructor Documentation

fcppt::log::context::context ( )

Constructs a context with no locations.

fcppt::log::context::~context ( )

Destroys a context.

It is important that all the logger objects that are associated with this context are already destroyed.

Warning
The behaviour is undefined if this context still has associated logger objects.

Member Function Documentation

void fcppt::log::context::apply ( fcppt::log::location const &  location,
fcppt::log::tree_function const &  function 
)

Applies a function to all logers given a location recursively.

Applies function to the loggers at location and below.

Exceptions
fcppt::log::no_such_locationif the location doesn't exist
fcppt::log::optional_object const fcppt::log::context::find ( fcppt::log::location const &  location) const

Searches for a logger with a given location.

Searches for a logger whose location is location.

Parameters
locationThe location to search
Returns
If the logger is found, it will be returned, otherwise an empty fcppt::log::optional_object will be returned.