Python Logging API

In addition to the environment variable initialization described in the top level logging documentation, pysvs exposes a programatic API in the pysvs.logging submodule.

Logging API

pysvs.logging.get_level() pysvs.logging.level

Get the current logging level.

class pysvs.logging.level

Log levels used by SVS listed in increasing level of severity. Only messages equal to or more severe than the currently configured log level will be reported.

Members:

trace : The most verbose logging

debug : Log diagnostic debug information

info : Report general information. Useful for long-running operations

warn : Report information that is not immediately an error, but could be potentially problematic

error : Report errors

critical : Report critical message that generall should not be suppressed

off : Disable logging

property name
pysvs.logging.log_message(level: pysvs.logging.level, message: str) None

Log the message with the given severity level.

pysvs.logging.set_level(level: pysvs.logging.level) None

Set logging to the specified level. Only messages more severe than the set level will be reported.

pysvs.logging.set_logging_file(file: os.PathLike) None

Direct all logging message to the specified file. Caller must have sufficient permissions to create the file.

Note that setting this will supersede the default environment variable selection mechanism and all previous calls to pysvs.logging.set_logging_stream and pysvs.logging.set_logging_file.

pysvs.logging.set_logging_stream(stream: pysvs.logging.stream) None

Route logging to use the specified stream. Note that setting this will supersede the default environment variable selection mechanism and all previous calls to pysvs.logging.set_logging_stream and pysvs.logging.set_logging_file.

class pysvs.logging.stream

Built-in Logging Stream

Members:

stdout : Route all logging to stdout

stderr : Route all logging to stderr

null : Suppress all logging

property name