libcaf
0.15.5
|
Centrally logs events from all actors in an actor system. More...
#include <logger.hpp>
Classes | |
struct | arg_wrapper |
Enables automagical string conversion for CAF_ARG . More... | |
struct | event |
Encapsulates a single logging event. More... | |
struct | field |
Represents a single format string field. More... | |
class | line_builder |
Utility class for building user-defined log messages with CAF_ARG . More... | |
Public Types | |
enum | field_type { invalid_field, category_field, class_name_field, date_field, file_field, line_field, message_field, method_field, newline_field, priority_field, runtime_field, thread_field, actor_field, percent_sign_field, plain_text_field } |
Internal representation of format string entites. | |
using | line_format = std::vector< field > |
Stores a parsed format string as list of fields. | |
Public Member Functions | |
actor_id | thread_local_aid () |
Returns the ID of the actor currently associated to the calling thread. | |
actor_id | thread_local_aid (actor_id aid) |
Associates an actor ID to the calling thread and returns the last value. | |
void | log (event *x) |
Writes an entry to the log file. | |
const line_format & | file_format () const |
Returns the output format used for the log file. | |
const line_format & | console_format () const |
Returns the output format used for the console. | |
void | render (std::ostream &out, const line_format &lf, const event &x) const |
Renders x using the line format lf to out . | |
![]() | |
ref_counted (const ref_counted &) | |
ref_counted & | operator= (const ref_counted &) |
void | ref () noexcept |
Increases reference count by one. | |
void | deref () noexcept |
Decreases reference count by one and calls request_deletion when it drops to zero. More... | |
bool | unique () const noexcept |
Queries whether there is exactly one reference. | |
size_t | get_reference_count () const noexcept |
![]() | |
virtual void | request_deletion (bool decremented_rc) noexcept |
Default implementations calls `delete this, but can be overriden in case deletion depends on some condition or the class doesn't use default new/delete. More... | |
Static Public Member Functions | |
template<class T > | |
static arg_wrapper< T > | make_arg_wrapper (const char *name, const T &value) |
Used to implement CAF_ARG . | |
static void | render_fun_prefix (std::ostream &out, const char *pretty_fun) |
Renders the prefix (namespace and class) of a fully qualified function. | |
static void | render_fun_name (std::ostream &out, const char *pretty_fun) |
Renders the name of a fully qualified function. | |
static void | render_time_diff (std::ostream &out, timestamp t0, timestamp tn) |
Renders the difference between t0 and tn in milliseconds. | |
static void | render_date (std::ostream &out, timestamp x) |
Renders the date of x in ISO 8601 format. | |
static line_format | parse_format (const char *format_str) |
Parses format_str into a format description vector. More... | |
template<class T > | |
static std::enable_if< std::is_base_of< mixin::subscriber_base, T >::value, std::string >::type | joined_groups_of (const T &x) |
Returns a string representation of the joined groups of x if x is an actor with the subscriber mixin. More... | |
template<class T > | |
static std::enable_if< !std::is_base_of< mixin::subscriber_base, T >::value, const char *>::type | joined_groups_of (const T &x) |
Returns a string representation of an empty list if x is not an actor with the subscriber mixin. More... | |
Friends | |
class | actor_system |
Additional Inherited Members | |
![]() | |
std::atomic< size_t > | rc_ |
![]() | |
void | intrusive_ptr_add_ref (ref_counted *p) |
void | intrusive_ptr_release (ref_counted *p) |
Centrally logs events from all actors in an actor system.
To enable logging in your application, you need to define CAF_LOG_LEVEL
. Per default, the logger generates log4j compatible output.
|
static |
Returns a string representation of the joined groups of x
if x
is an actor with the subscriber
mixin.
|
static |
Returns a string representation of an empty list if x
is not an actor with the subscriber
mixin.
|
static |
Parses format_str
into a format description vector.
format_str
.