Powered by Tachyonic Project Luxon Framework v0.0.0

Luxon Framework for rapid application development. (luxon)

Version

Logger

Luxon has a built in logger to provide a conveniant high-level common interface with extended functionality.

The logger wraps around python logging facilities and ensures that formatting and handlers are managed within the context of the python interpreter.

The logger can be configured with the settings.ini file.

Example Usage

from luxon import GetLogger

# As per per 282 use the module name.
log = GetLogger(__name__)

log.critical('Critical message')
log.error('Error message')
log.warning('Warning message')
log.info('Informational message')
log.debug('Debug message')

# Returns bool if in debug mode.
log.debug_mode()

GetLogger Class

class luxon.core.logger.GetLogger(name=None)[source]

Wrapper Class for convienance.

Parameters:name (str) – Typical Module Name, sub-logger name, (optional)

Ensures all log output is formatted correctly.

critical(msg, prepend=None, append=None, timer=None, log_id=None)[source]

Log Critical Message.

Parameters:
  • msg (str) – Log Message.
  • prepend (str) – Prepend Message (optional)
  • append (str) – Append Message (optional)
  • timer (int) – Integer value in ms. Usually from luxon.utils.timer.Timer Adds (DURATION: time) to log entry.
debug(msg, prepend=None, append=None, timer=None, log_id=None)[source]

Log Debug Message.

Parameters:
  • msg (str) – Log Message.
  • prepend (str) – Prepend Message (optional)
  • append (str) – Appener value returned using
  • timer (int) – Integer value in ms. Usually from luxon.utils.timer.Timer Adds (DURATION: time) to log entry.
error(msg, prepend=None, append=None, timer=None, log_id=None)[source]

Log Error Message.

Parameters:
  • msg (str) – Log Message.
  • prepend (str) – Prepend Message (optional)
  • append (str) – Append Message (optional)
  • timer (int) – Integer value in ms. Usually from luxon.utils.timer.Timer Adds (DURATION: time) to log entry.
info(msg, prepend=None, append=None, timer=None, log_id=None)[source]

Log Info Message.

Parameters:
  • msg (str) – Log Message.
  • prepend (str) – Prepend Message (optional)
  • append (str) – Append Message (optional)
  • timer (int) – Integer value in ms. Usually from luxon.utils.timer.Timer Adds (DURATION: time) to log entry.
warning(msg, prepend=None, append=None, timer=None, log_id=None)[source]

Log Warning Message.

Parameters:
  • msg (str) – Log Message.
  • prepend (str) – Prepend Message (optional)
  • append (str) – Append Message (optional)
  • timer (int) – Integer value in ms. Usually from luxon.utils.timer.Timer Adds (DURATION: time) to log entry.

Request Context

You can append values to each log entry made within the context of a request by using the log dictionary provided by the request.

An example would be:

req.log['username'] = 'Foo'
# This would append '(username:Foo) to logs.