C++ Actor Framework 0.19
|
Centrally logs events from all actors in an actor system. More...
#include <logger.hpp>
Classes | |
struct | config |
Combines various logging-related flags and parameters into a bitfield. 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 } |
using | line_format = std::vector< field > |
Stores a parsed format string as list of fields. | |
![]() | |
using | super = detail::atomic_ref_counted |
Public Member Functions | |
void | log (event &&x) |
Writes an entry to the event-queue of the logger. | |
bool | accepts (unsigned level, std::string_view component_name) |
Returns whether the logger is configured to accept input for given component and log level. | |
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. | |
unsigned | verbosity () const noexcept |
unsigned | file_verbosity () const noexcept |
unsigned | console_verbosity () const noexcept |
void | render (std::ostream &out, const line_format &lf, const event &x) const |
Renders x using the line format lf to out . | |
![]() | |
atomic_ref_counted (const atomic_ref_counted &) | |
atomic_ref_counted & | operator= (const atomic_ref_counted &) |
void | ref () const noexcept |
Increases reference count by one. | |
void | deref () const noexcept |
Decreases reference count by one and calls request_deletion when it drops to zero. | |
bool | unique () const noexcept |
Queries whether there is exactly one reference. | |
size_t | get_reference_count () const noexcept |
Queries the current reference count for this object. | |
Static Public Member Functions | |
static actor_id | thread_local_aid () |
Returns the ID of the actor currently associated to the calling thread. | |
static actor_id | thread_local_aid (actor_id aid) |
Associates an actor ID to the calling thread and returns the last value. | |
static void | render_fun_prefix (std::ostream &out, const event &x) |
Renders the prefix (namespace and class) of a fully qualified function. | |
static void | render_fun_name (std::ostream &out, const event &x) |
Renders the name of a fully qualified function. | |
static void | render_date (std::ostream &out, timestamp x) |
Renders the date of x in ISO 8601 format. | |
static line_format | parse_format (const std::string &format_str) |
Parses format_str into a format description vector. | |
static std::string_view | skip_path (std::string_view filename) |
Skips path in filename . | |
static void | set_current_actor_system (actor_system *) |
Stores the actor system for the current thread. | |
static logger * | current_logger () |
Returns the logger for the current thread or nullptr if none is registered. | |
Static Public Attributes | |
static constexpr size_t | queue_size = 128 |
Configures the size of the circular event queue. | |
Friends | |
class | actor_system |
Additional Inherited Members | |
![]() | |
std::atomic< size_t > | rc_ |
![]() | |
template<class T , class... Ts> | |
intrusive_cow_ptr< T > | make_copy_on_write (Ts &&... xs) |
Constructs an object of type T in an intrusive_cow_ptr . | |
template<class T , class... Ts> | |
intrusive_ptr< T > | make_counted (Ts &&... xs) |
Constructs an object of type T in an intrusive_ptr . | |
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.
void caf::logger::log | ( | event && | x | ) |
Writes an entry to the event-queue of the logger.
@thread-safe
|
static |
Parses format_str
into a format description vector.
format_str
.