|
CAF
0.17.6
|
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 } |
| Internal representation of format string entites. | |
| using | line_format = std::vector< field > |
| Stores a parsed format string as list of fields. | |
Public Member Functions | |
| void | log (event &&x) |
| Writes an entry to the event-queue of the logger. More... | |
| 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. | |
| bool | accepts (unsigned level, atom_value 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. | |
Public Member Functions inherited from caf::ref_counted | |
| ref_counted (const ref_counted &) | |
| ref_counted & | operator= (const 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 |
Public Member Functions inherited from caf::memory_managed | |
| virtual void | request_deletion (bool decremented_rc) const 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 | |
| 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_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 std::string &format_str) |
Parses format_str into a format description vector. More... | |
| static string_view | skip_path (string_view filename) |
Skips path in filename. | |
| 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. | |
| 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. | |
| 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 | |
Protected Attributes inherited from caf::ref_counted | |
| std::atomic< size_t > | rc_ |
Related Functions inherited from caf::ref_counted | |
| void | intrusive_ptr_add_ref (const ref_counted *p) |
| void | intrusive_ptr_release (const 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.
| 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.