vrLogService

class vrLogService

(Inherits vrBaseService)

Service that provides access to logging functionality.

When using the setLogEnabled, setLogLevel or setLogType functions for temporarily changing the logging behavior, ensure that the corresponding revert call is executed. It’s suggested to use a try statement like in the following example:

logEnabled = vrLogService.isLogEnabled()
vrLogService.setLogEnabled(False)
try:
    findNode("Name")
finally:
    vrLogService.setLogEnabled(logEnabled)

Functions

vrLogService.error(message, context={})

Adds a new error log message.

Error messages are typically printed in red.

Parameters:
  • message (string) – The error which should be added to the log.
  • context (string) – Optional context string. Will be shown in squared brackets in front of the the message e.g. [Scenegraph] Node locked.
vrLogService.getLogType()
Returns:The current active log type.
Return type:vrLogTypes.LogType
vrLogService.info(message, context={})

Adds a new info log message.

Parameters:
  • message (string) – The info which should be added to the log.
  • context (string) – Optional context string. Will be shown in squared brackets in front of the the message e.g. [Scenegraph] Node locked.
vrLogService.isLogEnabled()
Returns:True if logging is enabled, False otherwise.
Return type:bool
vrLogService.setLogEnabled(value)

Enables or disables logging.

Parameters:value (bool) – If True, logging is enabled. False disables logging.
vrLogService.setLogLevel(level)

Sets a log level.

The log level defines which type of log messages are displayed in the terminal and log file. Currently, there are three different types of log levels: Error, Warning and Info. Each level will output messages for the specified type as well as higher severity types. For example, log level Warning will also output Errors.

Parameters:level (vrLogTypes.Level) – The log level used for output.
vrLogService.setLogType(type)

Sets the log message type.

Parameters:type (vrLogTypes.LogType) – The message type which should be active. This can also be a combination of types.
vrLogService.warning(message, context={})

Adds a new warning log message.

Warning messages are typically printed in yellow.

Parameters:
  • message (string) – The warning which should be added to the log.
  • context (string) – Optional context string. Will be shown in squared brackets in front of the the message e.g. [Scenegraph] Node locked.