Package flumotion :: Package common :: Module log
[show private | hide private]
[frames | no frames]

Module flumotion.common.log

Flumotion logging

Just like in GStreamer, five levels of log information are defined. These are, in order of decreasing verbosity: log, debug, info, warning, error.

API Stability: stabilizing

Maintainer: Thomas Vander Stichele
Classes
FluLogObserver Twisted log observer that integrates with Flumotion's logging.
Loggable Base class for objects that want to be able to log messages with different level of severity.

Function Summary
  addLogHandler(func, limited)
Add a custom log handler.
  debug(cat, *args)
  debugObject(object, cat, *args)
Log a debug message in the given category.
  error(cat, *args)
  errorObject(object, cat, *args)
Log a fatal error message in the given category.
  getCategoryLevel(category)
  getExceptionMessage(exception)
  getFileLine()
Return a tuple of (file, line) for the first stack entry outside of log.py (which would be the caller of log)
  getLevel(level)
Return an integer value that represents the level.
  info(cat, *args)
  infoObject(object, cat, *args)
Log an informational message in the given category.
  init()
Initialize the logging system and parse the FLU_DEBUG environment variable.
  log(cat, *args)
  logObject(object, cat, *args)
Log a log message.
  registerCategory(category)
Register a given category in the debug system.
  reset()
Resets the logging system, removing all log handlers.
  scrubFilename(filename)
Scrub the filename of everything before 'flumotion' and 'twisted' to make them shorter.
  setFluDebug(string)
Set the FLU_DEBUG string.
  stderrHandler(level, object, category, file, line, message)
A log handler that writes to stdout.
  warning(cat, *args)
  warningObject(object, cat, *args)
Log a warning message in the given category.
  _handle(level, object, category, message)

Variable Summary
dict _categories = {}
str _FLU_DEBUG = '*:1'
bool _initialized = False
dict _levels = {'WARN': 2, 'INFO': 3, 'DEBUG': 4, 'LOG': 5, '...
list _log_handlers = []
list _log_handlers_limited = []

Function Details

addLogHandler(func, limited=True)

Add a custom log handler.
Parameters:
func - a function object with prototype (level, object, category, message) where all of them are strings or None.
           (type=a callable function)
limited - whether to automatically filter based on FLU_DEBUG
           (type=boolean)

debugObject(object, cat, *args)

Log a debug message in the given category.

errorObject(object, cat, *args)

Log a fatal error message in the given category. This will also raise a flumotion.common.errors.SystemError.

getCategoryLevel(category)

Parameters:
category -

string

Get the debug level at which this category is being logged, adding it if it wasn't registered yet.

getFileLine()

Return a tuple of (file, line) for the first stack entry outside of log.py (which would be the caller of log)

getLevel(level)

Return an integer value that represents the level.

infoObject(object, cat, *args)

Log an informational message in the given category.

init()

Initialize the logging system and parse the FLU_DEBUG environment variable. Needs to be called before starting the actual application.

logObject(object, cat, *args)

Log a log message. Used for debugging recurring events.

registerCategory(category)

Register a given category in the debug system. A level will be assigned to it based on the setting of FLU_DEBUG.

reset()

Resets the logging system, removing all log handlers.

scrubFilename(filename)

Scrub the filename of everything before 'flumotion' and 'twisted' to make them shorter.

setFluDebug(string)

Set the FLU_DEBUG string. This controls the log output.

stderrHandler(level, object, category, file, line, message)

A log handler that writes to stdout.
Parameters:
level
           (type=string)
object
           (type=string (or None))
category
           (type=string)
message
           (type=string)

warningObject(object, cat, *args)

Log a warning message in the given category. This is used for non-fatal problems.

Variable Details

_categories

Type:
dict
Value:
{}                                                                     

_FLU_DEBUG

Type:
str
Value:
'*:1'                                                                  

_initialized

Type:
bool
Value:
False                                                                  

_levels

Type:
dict
Value:
{'WARN': 2, 'INFO': 3, 'DEBUG': 4, 'LOG': 5, 'ERROR': 1}               

_log_handlers

Type:
list
Value:
[]                                                                     

_log_handlers_limited

Type:
list
Value:
[]                                                                     

Generated by Epydoc 2.1 on Wed Jul 27 23:00:05 2005 http://epydoc.sf.net