OpenEnroth 73e68f7
|
#include <LogCategory.h>
Public Member Functions | |
LogCategory (std::string_view name, LogSource *source=nullptr) | |
~LogCategory () | |
LogCategory (const LogCategory &)=delete | |
LogCategory (LogCategory &&)=default | |
std::string_view | name () const |
LogSource * | source () const |
Static Public Member Functions | |
static std::vector< LogCategory * > | instances () |
Private Attributes | |
std::string_view | _name |
LogSource * | _source = nullptr |
std::optional< LogLevel > | _level |
std::optional< int > | _adjustedLevel |
Friends | |
class | Logger |
Log category, usually used to differentiate logging calls from different subsystems.
Intended usage is to just create a static
instance in a .cpp
file, and use it when logging.
Log category can be associated with a LogSource
, which will then be used when changing per-category log levels.
|
explicit |
Creates and registers a new log category instance.
name | Name of the log category. LogCategory doesn't copy the provided string, so the user is expected to pass a string constant. Different LogCategory instances are expected to have different names, and the constructor will assert if this is not satisfied. |
source | Log source, if any. LogCategory doesn't take ownership of the provided LogSource , and thus lifetime management is up to the user. The best practice is to create both the LogSource and LogCategory as global variables. |
LogCategory::~LogCategory | ( | ) |
|
delete |
|
default |
|
static |
|
inline |
|
inline |
|
friend |
|
private |
|
private |
|
private |
|
private |