toast::logger< VerbosityPolicy, OutputPolicy, ThreadPolicy > Class Template Reference
[toast logging library]

#include <toast/log.hpp>

List of all members.


Detailed Description

template<typename VerbosityPolicy = log::check_verbosity, typename OutputPolicy = log::to_stderr_buffered<>, typename ThreadPolicy = log::neutral>
class toast::logger< VerbosityPolicy, OutputPolicy, ThreadPolicy >

All log messages go through here.

toast::logger is effectively a policy holder class. It's a thin wrapper over top of the policy classes the user has passed in. The policy types are VerbosityPolicy, OutputPolicy, HeaderPolicy, FooterPolicy, and ThreadPolicy. In order to compile each has to match their respective concept (i.e. VerbosityPolicyConcept). There are a number of options available within the toast::log library for each policy, and reasonable defaults selected, but you can create your own policies to extend the toast::log library as you see fit.

See also:
verbosity_policies.hpp output_policies.hpp header_policies.hpp footer_policies.hpp thread_policies.hpp

Public Types

typedef ThreadPolicy::scoped_lock scoped_lock
 scoped_lock allows you to lock a logger based on its thread policy.
typedef OutputPolicy::char_type char_type
typedef OutputPolicy output_policy
typedef logger this_type

Public Member Functions

void message (char_type const *m, log::severity severity=log::DEFAULT)
 message() logs a message.
template<typename Traits, typename Alloc>
void message (std::basic_string< char_type, Traits, Alloc > const &m, log::severity severity=log::DEFAULT)
 message() logs a message.
void consume_message (char_type *m, log::severity severity=log::DEFAULT)
 consume_message() logs a message and gives ownership of it to the log.
void forced_message (char_type const *m, log::severity severity=log::DEFAULT)
 forced_message() logs a message.
void consume_forced_message (char_type const *m, log::severity severity=log::DEFAULT)
 forced_message() logs a message.
template<typename Traits, typename Alloc>
void forced_message (std::basic_string< char_type, Traits, Alloc > const &m, log::severity severity=log::DEFAULT)
 forced_message() logs a message.

Friends

class basic_log_handle< char_type >

Member Typedef Documentation

template<typename VerbosityPolicy = log::check_verbosity, typename OutputPolicy = log::to_stderr_buffered<>, typename ThreadPolicy = log::neutral>
typedef ThreadPolicy::scoped_lock toast::logger< VerbosityPolicy, OutputPolicy, ThreadPolicy >::scoped_lock

scoped_lock allows you to lock a logger based on its thread policy.

See also:
thread_policies.hpp


Member Function Documentation

template<typename VerbosityPolicy = log::check_verbosity, typename OutputPolicy = log::to_stderr_buffered<>, typename ThreadPolicy = log::neutral>
void toast::logger< VerbosityPolicy, OutputPolicy, ThreadPolicy >::message ( char_type const *  m,
log::severity  severity = log::DEFAULT 
) [inline]

message() logs a message.

Logs a message if the result of check(severity) is true.

See also:
verbosity_policies.hpp

template<typename VerbosityPolicy = log::check_verbosity, typename OutputPolicy = log::to_stderr_buffered<>, typename ThreadPolicy = log::neutral>
template<typename Traits, typename Alloc>
void toast::logger< VerbosityPolicy, OutputPolicy, ThreadPolicy >::message ( std::basic_string< char_type, Traits, Alloc > const &  m,
log::severity  severity = log::DEFAULT 
) [inline]

message() logs a message.

Logs a message if the result of check(severity) is true.

See also:
verbosity_policies.hpp

template<typename VerbosityPolicy = log::check_verbosity, typename OutputPolicy = log::to_stderr_buffered<>, typename ThreadPolicy = log::neutral>
void toast::logger< VerbosityPolicy, OutputPolicy, ThreadPolicy >::consume_message ( char_type *  m,
log::severity  severity = log::DEFAULT 
) [inline]

consume_message() logs a message and gives ownership of it to the log.

Logs a message if the result of check(severity) is true. The given string may or may not be empty after consumption, depending on the OutputPolicy.

See also:
verbosity_policies.hpp

template<typename VerbosityPolicy = log::check_verbosity, typename OutputPolicy = log::to_stderr_buffered<>, typename ThreadPolicy = log::neutral>
void toast::logger< VerbosityPolicy, OutputPolicy, ThreadPolicy >::forced_message ( char_type const *  m,
log::severity  severity = log::DEFAULT 
) [inline]

forced_message() logs a message.

Logs a message regardless of the verbosity policy. This should be used when you're composing a message. You would want to check the verbosity prior to composing (i.e. don't compose if you don't have to) and then force the message through, so you don't check verbosity twice.

See also:
verbosity_policies.hpp

template<typename VerbosityPolicy = log::check_verbosity, typename OutputPolicy = log::to_stderr_buffered<>, typename ThreadPolicy = log::neutral>
void toast::logger< VerbosityPolicy, OutputPolicy, ThreadPolicy >::consume_forced_message ( char_type const *  m,
log::severity  severity = log::DEFAULT 
) [inline]

forced_message() logs a message.

Logs a message regardless of the verbosity policy. This should be used when you're composing a message. You would want to check the verbosity prior to composing (i.e. don't compose if you don't have to) and then force the message through, so you don't check verbosity twice.

See also:
verbosity_policies.hpp
The given string may or may not be empty after consumption, depending on the OutputPolicy.

template<typename VerbosityPolicy = log::check_verbosity, typename OutputPolicy = log::to_stderr_buffered<>, typename ThreadPolicy = log::neutral>
template<typename Traits, typename Alloc>
void toast::logger< VerbosityPolicy, OutputPolicy, ThreadPolicy >::forced_message ( std::basic_string< char_type, Traits, Alloc > const &  m,
log::severity  severity = log::DEFAULT 
) [inline]

forced_message() logs a message.

Logs a message regardless of the verbosity policy. This should be used when you're composing a message. You would want to check the verbosity prior to composing (i.e. don't compose if you don't have to) and then force the message through, so you don't check verbosity twice.

See also:
verbosity_policies.hpp


The documentation for this class was generated from the following file:

SourceForge.net Logo