deptcharge.log

Depthcharge provides simple logging functionality atop of Python’s own logging module.

The log level is initialized according to the level name (string) set in the the DEPTHCHARGE_LOG_LEVEL environment variable. If not present, the Depthcharge logging defaults to the 'note' level.

Below are the available levels in order of decreasing verbosity, and with their associated message prefix symbols.

Level Name

Msg. Prefix

Description

debug

[#]

Highly verbose information used to diagnose failures in core code

note

[*]

Verbose status and progress information intended for end user

info

[+]

Higher-level status and progress information - usually success

warning

[!]

Similar to info, but for reporting undesirable status

error

[X]

Describes what is failing and why to an end user

silent

N/A

Deptcharge does not write log output to stderr

During long running operations, Depthcharge will only display progress bars when the log level is set to note, info, or warning.

The debug level is too verbose for progress bars to provide any value. Conversely, if one is only interested in seeing output pertaining to failures, the progress bars become obtrusive.

In addition to setting the DEPTHCHARGE_LOG_LEVEL environment variable, Depthcharge’s log verbosity can be set using this submodule’s set_level() function.

class depthcharge.log.DepthchargeLog(prefix='', logger_name='depthcharge')

This class implements Depthcharge’s custom logging.

All instances of this class share the same underlying Python logger.

property level

Current log level

debug(*args, **kwargs)

Write a debug-level message to the log.

This should be used for detailed diagnostic information that most users will never need to see.

note(*args, **kwargs)

Write a note-level message to the log.

This should be used for detailed information pertaining to an operation, especially for lower-level operations.

info(*args, **kwargs)

Write an info-level message to the log.

This should be used to notify the user of an high-level operation starting or completing successfully.

Consider instead using note() for messages that might be helpful, but not necessary for users who are familiar with Depthcharge.

warning(*args, **kwargs)

Write a warning-level message to the log.

This should be used to report failures or undesired behavior that can be worked around (e.g., by using a slower, less-preferable operation), or to otherwise draw a user’s attention to an important piece of information that might be problematic later.

error(*args, **kwargs)

Write an error-level message to the log.

This should be used to report issues or unexpected behavior that will immediately result in a failed operation.

depthcharge.log.debug(*args, **kwargs)

Invokes Depthcharge root logger’s DepthchargeLog.debug() method’

depthcharge.log.note(*args, **kwargs)

Invokes Depthcharge root logger’s DepthchargeLog.note() method’

depthcharge.log.info(*args, **kwargs)

Invokes Depthcharge root logger’s DepthchargeLog.info() method’

depthcharge.log.warning(*args, **kwargs)

Invokes Depthcharge root logger’s DepthchargeLog.warning() method’

depthcharge.log.error(*args, **kwargs)

Invokes Depthcharge root logger’s DepthchargeLog.error() method’

depthcharge.log.set_level(level)

Set Depthcharge’s logger to the specified level.

This may be one of the following integers:

  • depthcharge.log.DEBUG

  • depthcharge.log.NOTE

  • depthcharge.log.INFO

  • depthcharge.log.WARNING

  • depthcharge.log.ERROR

  • depthcharge.log.SILENT

Alternatively the following strings may be used:

  • 'debug'

  • 'note'

  • 'info'

  • 'warning'

  • 'error'

  • 'silent'

depthcharge.log.get_level()int

Get the current level of Depthcharge’s logger.