|
qxLib
|
Logger class. More...
#include <logger.h>
Classes | |
| struct | category_data |
Public Member Functions | |
| template<sbo_poly_assignable_c< base_logger_stream > stream_t> | |
| void | add_stream (stream_t stream) noexcept |
| Add an output stream to the logger. More... | |
| template<sbo_poly_assignable_c< base_logger_stream > stream_t> | |
| stream_t * | get_stream () noexcept |
| Get the first occurrence of a stream of the given type. More... | |
| template<sbo_poly_assignable_c< base_logger_stream > stream_t> | |
| auto | get_streams () noexcept |
| Get all the streams of the given type. More... | |
| std::shared_mutex & | get_streams_mutex () noexcept |
| Get streams mutex. More... | |
| template<sbo_poly_assignable_c< base_logger_stream > stream_t> | |
| size_t | remove_streams () noexcept |
| Remove all the streams of the given type. More... | |
| void | register_category (const category &category, category_data data) noexcept |
| Add custom rules for category. More... | |
| void | register_category (string_view svCategoryName, category_data data) noexcept |
| Add custom rules for category. More... | |
| void | set_default_formatter (format_function_pointer pFormatter) noexcept |
| Set a function that will be used as the default formatter in case no formatter found in categories registered. More... | |
| virtual void | log (const category &category, verbosity eVerbosity, std::thread::id threadId, std::chrono::system_clock::time_point messageTime, string_view svFile, string_view svFunction, int nLine, logger_string_pool::item message) |
| Log to all streams. More... | |
| virtual void | flush () |
| Flush all streams. | |
| virtual void | reset () noexcept |
| Reset logger and clear all streams. | |
| flags< message_necessity_type > | get_message_necessity_type (const category &category, verbosity eVerbosity, std::thread::id threadId, std::chrono::system_clock::time_point messageTime, string_view svFile, string_view svFunction, int nLine) const noexcept |
| Check if this message will go somewhere. More... | |
|
inlinenoexcept |
Add an output stream to the logger.
| stream_t | - stream type, derived from base_logger_stream |
| stream | - stream object |
Definition at line 35 of file logger.inl.
|
inlinenoexcept |
Check if this message will go somewhere.
Typically you don't want to use it. It may be useful with async logging to avoid unnecessary formatting and queueing.
| category | - code category |
| eVerbosity | - message verbosity |
| threadId | - thread where the log is called |
| messageTime | - message creation time |
| svFile | - file name string |
| svFunction | - function name string |
| nLine | - code line number |
| - | get message necessity type |
Definition at line 187 of file logger.inl.
|
inlinenoexcept |
Get the first occurrence of a stream of the given type.
| stream_t | - stream type to search for |
| - | stream pointer or nullptr if no stream found |
Definition at line 42 of file logger.inl.
|
inlinenoexcept |
Get all the streams of the given type.
| stream_t | - stream type to search for |
| - | streams view |
Definition at line 49 of file logger.inl.
|
inlinenoexcept |
|
inlinevirtual |
Log to all streams.
| category | - code category |
| eVerbosity | - message verbosity |
| threadId | - thread where the log is called |
| messageTime | - message creation time |
| svFile | - file name string |
| svFunction | - function name string |
| nLine | - code line number |
| message | - user message string |
Definition at line 87 of file logger.inl.
|
inlinenoexcept |
Add custom rules for category.
| category | - category to register |
| data | - category data |
Definition at line 71 of file logger.inl.
|
inlinenoexcept |
Add custom rules for category.
| svCategoryName | - category name, must stay valid while the logger is alive (category existence is not checked) |
| data | - category data |
Definition at line 76 of file logger.inl.
|
inlinenoexcept |
Remove all the streams of the given type.
| stream_t | - stream type to search for |
| - | number of streams removed |
Definition at line 65 of file logger.inl.
|
inlinenoexcept |
Set a function that will be used as the default formatter in case no formatter found in categories registered.
| pFormatter | - default formatter |
Definition at line 82 of file logger.inl.