maxon.LoggerInterface

Description

The logger interface allows to create new custom loggers for specific tasks and to access existing loggers.
Loggers are presented in the “Console” window in Cinema 4D and registered at the maxon.Loggers registry.

Inheritance diagram

Inheritance

Parent Class:

Child Class:

Methods Signature

AddLoggerType(ta, loggerTypeCls[, cb]) Adds a logger type to the logger.
AddNewLogger(id, logger[, moduleInfo])
Add a new logger to the system.
Enable(enable)
Enable or disable the logger.
GetName() Returns the name of the logger.
IsEnabled() Returns if the logger is enabled.
SetName(name) Sets the name of the logger.
Write([ta, str, loc, level]) Sends a string to all added logger types.

Methods Definition

LoggerInterface.AddLoggerType(ta, loggerTypeCls, cb=None)

Adds a logger type to the logger.

Parameters:
  • ta (maxon.TARGETAUDIENCE) –

    Set the audience.

    The logger type will get the string if the target audience matches when LoggerInterface.Write() is used.
  • loggerTypeCls (maxon.LoggerTypeRef) – The logger type reference to add.
  • cb (function) – 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.
static LoggerInterface.AddNewLogger(id, logger, moduleInfo=None)
Add a new logger to the system.
Does the same as Loggers.Insert(), but also triggers the observers.
Parameters:
  • id (maxon.Url) – The maxon Id corresponding to the logger.
  • logger (maxon.LoggerRef) – The logger reference to add.
  • moduleInfo (maxon.ModuleInfo) – The module which initiates the call. When the module is freed, the logger will be freed too.
LoggerInterface.Enable(enable)
Enable or disable the logger.
If disabled, the logger still consumes strings but discards them.
Parameters:enable (bool) – True or False to enable or disable the logger.
LoggerInterface.GetName()

Returns the name of the logger.

Returns:The name.
Return type:str
LoggerInterface.IsEnabled()

Returns if the logger is enabled.

Returns:True or False.
Return type:bool
LoggerInterface.SetName(name)

Sets the name of the logger.

Parameters:name (str) – The name.
LoggerInterface.Write(ta=14, str="test", loc=None, level=1)

Sends a string to all added logger types.

Parameters:
  • ta (maxon.TARGETAUDIENCE) – All logger types which match the target audience will receive the string.
  • str (str) – Text to print.
  • loc (maxon.SourceLocation) – Source location where the string was printed from.
  • level (maxon.WRITEMETA) – Meta information for the current write operation.