#include <toast/log.hpp>
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.
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 > |
typedef ThreadPolicy::scoped_lock toast::logger< VerbosityPolicy, OutputPolicy, ThreadPolicy >::scoped_lock |
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.
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.
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.
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.
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.
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.