#include <logger.h>
Public Types | |
| using | LOGGERTYPEINITCALLBACK = Delegate< Result< void >(LoggerTypeRef &logger)> |
Public Member Functions | |
| MAXON_METHOD Result< void > | AddLoggerType (TARGETAUDIENCE ta, const Class< LoggerTypeRef > &loggerTypeCls, const LOGGERTYPEINITCALLBACK &cb=DefaultLoggerTypeInit) |
| MAXON_METHOD Result< void > | RemoveLoggerType (LoggerTypeRef &loggerType) |
| MAXON_METHOD Result< void > | RemoveLoggerTypes (const Class< LoggerTypeRef > &loggerTypeCls) |
| MAXON_METHOD Result< void > | Write (TARGETAUDIENCE ta, const String &str, const maxon::SourceLocation &loc, WRITEMETA level=WRITEMETA::DEFAULT) |
| MAXON_METHOD String | GetName () const |
| MAXON_METHOD void | SetName (const String &name) |
| MAXON_METHOD void | Enable (Bool enable) |
| MAXON_METHOD Bool | IsEnabled () |
| MAXON_METHOD BaseArray< Pair< LoggerTypeRef, TARGETAUDIENCE > > | GetLoggerTypes () const |
| MAXON_OBSERVABLE_STATIC (void, ObservableLoggerNew,(const LoggerRef &logger), ObservableCombinerRunAllComponent) | |
Static Public Member Functions | |
| static MAXON_METHOD LoggerInterface * | Alloc (MAXON_SOURCE_LOCATION_DECLARATION) |
| static MAXON_METHOD Result< void > | AddNewLogger (const Id &id, const LoggerRef &logger, const maxon::ModuleInfo *module=&PRIVATE_MAXON_MODULE) |
Private Member Functions | |
| MAXON_INTERFACE_NONVIRTUAL (LoggerInterface, MAXON_REFERENCE_NORMAL, "net.maxon.interface.logger", MAXON_IMPLEMENTATION_MODULE("net.maxon.kernel")) | |
Static Private Member Functions | |
| static Result< void > | DefaultLoggerTypeInit (LoggerTypeRef &) |
| using LOGGERTYPEINITCALLBACK = Delegate<Result<void>(LoggerTypeRef& logger)> |
|
private |
|
static |
Allocates a logger.
| MAXON_METHOD Result<void> AddLoggerType | ( | TARGETAUDIENCE | ta, |
| const Class< LoggerTypeRef > & | loggerTypeCls, | ||
| const LOGGERTYPEINITCALLBACK & | cb = DefaultLoggerTypeInit |
||
| ) |
Adds a logger type to the logger.
| [in] | ta | Set the audience. The logger type will get the string if the target audience matches when LoggerInterface::Write is used. |
| [in] | loggerTypeCls | Class object of logger type ref (e.g. maxon::LoggerTypes::Application()) |
| [in] | cb | Optional callback that is executed to initialize a logger type after added to the logger. E.g. the file logger needs to be initialized with a destination path. |
| MAXON_METHOD Result<void> RemoveLoggerType | ( | LoggerTypeRef & | loggerType | ) |
Removes a logger type from a logger. Also succeeds if the logger type was not part of the logger.
| MAXON_METHOD Result<void> RemoveLoggerTypes | ( | const Class< LoggerTypeRef > & | loggerTypeCls | ) |
Removes all logger types of the passed type.
| [in] | loggerTypeCls | All logger types with the passed class type will be removed. |
| MAXON_METHOD Result<void> Write | ( | TARGETAUDIENCE | ta, |
| const String & | str, | ||
| const maxon::SourceLocation & | loc, | ||
| WRITEMETA | level = WRITEMETA::DEFAULT |
||
| ) |
Sends a string to all added logger types.
| [in] | ta | All logger types which match the target audience will receive the string. |
| [in] | str | String to print. |
| [in] | loc | Source location where the string was printed from. |
| [in] | level | Meta information for the current write operation. |
| MAXON_METHOD String GetName | ( | ) | const |
Returns the name of the logger.
| MAXON_METHOD void SetName | ( | const String & | name | ) |
Sets the name of the logger.
| [in] | name | The name. |
| MAXON_METHOD void Enable | ( | Bool | enable | ) |
Enable or disable the logger. If disabled, the logger still consumes strings but discards them.
| [in] | enable | True or false to enable or disable the logger. |
| MAXON_METHOD Bool IsEnabled | ( | ) |
Returns if the logger is enabled.
| MAXON_METHOD BaseArray<Pair<LoggerTypeRef, TARGETAUDIENCE> > GetLoggerTypes | ( | ) | const |
Returns all logger types including their audience.
| MAXON_OBSERVABLE_STATIC | ( | void | , |
| ObservableLoggerNew | , | ||
| (const LoggerRef &logger) | , | ||
| ObservableCombinerRunAllComponent | |||
| ) |
Add observer to get notified once a new logger got added.
| [in] | logger | The new logger. |
|
static |
Add a new logger to the system. Does the same as Loggers::Insert, but also triggers the observers.
| [in] | module | The module which initiates the call. When the module is freed, the logger will be freed too. |
|
staticprivate |