LoggerInterface Class Reference 系统

#include <logger.h>

Public Types

using  LOGGERTYPEINITCALLBACK = Delegate < Result < void >(LoggerTypeRef &logger)>

公共成员函数

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  启用 ( Bool enable)
MAXON_METHOD Bool   IsEnabled ()
MAXON_METHOD BaseArray < Pair < LoggerTypeRef, TARGETAUDIENCE > >  GetLoggerTypes () const
  MAXON_OBSERVABLE_STATIC (void, ObservableLoggerNew,(const LoggerRef &logger), ObservableCombinerRunAllComponent)

静态公共成员函数

static MAXON_METHOD LoggerInterface Alloc ( MAXON_SOURCE_LOCATION_DECLARATION )
static MAXON_ATTRIBUTE_FORCE_INLINE MAXON_METHOD Result < void >  AddNewLogger (const Id &id, const LoggerRef &logger, const maxon::ModuleInfo *module=&PRIVATE_MAXON_MODULE)

私有成员函数

  MAXON_INTERFACE_NONVIRTUAL ( LoggerInterface , MAXON_REFERENCE_NORMAL , "net.maxon.interface.logger")

Static Private Member Functions

static Result < void >  DefaultLoggerTypeInit (LoggerTypeRef &)

Member Typedef Documentation

◆  LOGGERTYPEINITCALLBACK

using LOGGERTYPEINITCALLBACK = Delegate < Result <void>(LoggerTypeRef& logger)>

成员函数文档编制

◆  MAXON_INTERFACE_NONVIRTUAL()

MAXON_INTERFACE_NONVIRTUAL ( LoggerInterface   ,
MAXON_REFERENCE_NORMAL   ,
"net.maxon.interface.logger"   
)
private

◆  Alloc()

static MAXON_METHOD LoggerInterface * Alloc ( MAXON_SOURCE_LOCATION_DECLARATION   )
static

Allocates a logger.

◆  AddLoggerType()

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 被使用。
[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.

◆  RemoveLoggerType()

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.

◆  RemoveLoggerTypes()

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.

◆  Write()

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.

◆  GetName()

MAXON_METHOD String GetName ( ) const

Returns the name of the logger.

返回
The name.

◆  SetName()

MAXON_METHOD void SetName ( const String name )

Sets the name of the logger.

参数
[in] name The name.

◆  Enable()

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.

◆  IsEnabled()

MAXON_METHOD Bool IsEnabled ( )

Returns if the logger is enabled.

返回
True or false.

◆  GetLoggerTypes()

MAXON_METHOD BaseArray < Pair <LoggerTypeRef, TARGETAUDIENCE > > GetLoggerTypes ( ) const

Returns all logger types including their audience.

返回
An array of pairs with logger types and the audience.

◆  MAXON_OBSERVABLE_STATIC()

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

◆  AddNewLogger()

static MAXON_ATTRIBUTE_FORCE_INLINE MAXON_METHOD Result <void> AddNewLogger ( const Id id ,
const LoggerRef &  logger ,
const maxon::ModuleInfo *  module = &PRIVATE_MAXON_MODULE  
)
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.
返回
An array of pairs with logger types and the audience.

◆  DefaultLoggerTypeInit()

static Result <void> DefaultLoggerTypeInit ( LoggerTypeRef &  )
static private