Package gnue :: Package common :: Package base :: Module log
[show private | hide private]

Module gnue.common.base.log

The log module extends the standard logging module with some convenience functions related to the logging schema used in GNU Enterprise.
Classes
Logger Derivated Logger class to make sure the correct file name is used instead of "log.py", which is the file actually calling the logger functions.

Function Summary
bool critical(msg, *args, **kwargs)
Write a critical error message to the logger named after the calling module.
bool critical_n(name, msg, *args, **kwargs)
Write a critical error message to the logger defined through the name parameter.
bool debug(msg, *args, **kwargs)
Write a debug message to the logger named after the calling module.
bool debug_n(name, msg, *args, **kwargs)
Write a debug message to the logger defined through the name parameter.
bool deprecated(msg, *args, **kwargs)
Write a deprecation warning message to the logger named after the calling module.
function deprecated_f(func)
Decorator to mark a function as deprecated.
function deprecated_f_n(name)
Decorator to mark a function as deprecated using a specific logger.
bool deprecated_n(name, msg, *args, **kwargs)
Write a deprecation warning message to the logger defined through the name parameter.
bool error(msg, *args, **kwargs)
Write an error message to the logger named after the calling module.
bool error_n(name, msg, *args, **kwargs)
Write an error message to the logger defined through the name parameter.
  excepthook(etype, evalue, etraceback)
Exception hook to log an exception to the "exception" logger family.
bool exception(msg, *args, **kwargs)
Log an exception to the logger named after the calling module.
bool exception_n(name, msg, *args, **kwargs)
Log an exception to the logger defined through the name parameter.
bool info(msg, *args, **kwargs)
Write an info message to the logger named after the calling module.
bool info_n(name, msg, *args, **kwargs)
Write an info message to the logger defined through the name parameter.
function logged_f(func)
Decorator to activate logging for a function.
function logged_f_n(name)
Decorator to activate logging for a function using a specific logger.
  stack(msg, *args, **kwargs)
Write a debug message to the logger named after the calling module including information about the current call stack.
  stack_n(name, msg, *args, **kwargs)
Write a debug message to the logger named after the calling module including information about the current call stack.
bool warning(msg, *args, **kwargs)
Write a warning message to the logger named after the calling module.
bool warning_n(name, msg, *args, **kwargs)
Write a warning message to the logger defined through the name parameter.
  __caller()
  __deprecated(name, func)
  __enter(name, func)
  __func_name(func, frame)
  __leave(name, func, result)

Variable Summary
list _CONFIG_FILES = []

Function Details

critical(msg, *args, **kwargs)

Write a critical error message to the logger named after the calling module.
Parameters:
msg - Message to log.
           (type=string or unicode)
Returns:
always True, so the call can be prefixed with assert.
           (type=bool)

critical_n(name, msg, *args, **kwargs)

Write a critical error message to the logger defined through the name parameter.
Parameters:
name - Logger name to log to.
           (type=string)
msg - Message to log.
           (type=string or unicode)
Returns:
always True, so the call can be prefixed with assert.
           (type=bool)

debug(msg, *args, **kwargs)

Write a debug message to the logger named after the calling module.
Parameters:
msg - Message to log.
           (type=string or unicode)
Returns:
Always True, so the call can be prefixed with assert.
           (type=bool)

debug_n(name, msg, *args, **kwargs)

Write a debug message to the logger defined through the name parameter.
Parameters:
name - Logger name to log to.
           (type=string)
msg - Message to log.
           (type=string or unicode)
Returns:
always True, so the call can be prefixed with assert.
           (type=bool)

deprecated(msg, *args, **kwargs)

Write a deprecation warning message to the logger named after the calling module.
Parameters:
msg - Message to log.
           (type=string or unicode)
Returns:
always True, so the call can be prefixed with assert.
           (type=bool)

deprecated_f(func)

Decorator to mark a function as deprecated.

If this decorator is applied to a function, every call to that function issues a deprecation warning.

Usage with Python 2.4 or later:
   @deprecated_f
   myfunction(self, foo, bar):
       :
Usage with Python 2.3:
   myfunction(self, foo, bar):
       :
   myfunction=deprecated_f(myfunction)
Parameters:
func - Function to put the deprecation warning wrapper around.
           (type=function)
Returns:
Function with the deprecation warning wrapper.
           (type=function)

deprecated_f_n(name)

Decorator to mark a function as deprecated using a specific logger.

If this decorator is applied to a function, every call to that function issues a deprecation warning.

Usage with Python 2.4 or later:
   @deprecated_f_n('my.logger.name')
   myfunction(self, foo, bar):
       :
Usage with Python 2.3:
   myfunction(self, foo, bar):
       :
   myfunction=deprecated_f_n('my.logger.name')(myfunction)
Parameters:
name - Logger name to use.
           (type=string)
Returns:
A function that accepts a function as argument and returns the function with a deprecation warning wrapper around it (look at the usage example above to understand this).
           (type=function)

deprecated_n(name, msg, *args, **kwargs)

Write a deprecation warning message to the logger defined through the name parameter.
Parameters:
name - Logger name to log to.
           (type=string)
msg - Message to log.
           (type=string or unicode)
Returns:
always True, so the call can be prefixed with assert.
           (type=bool)

error(msg, *args, **kwargs)

Write an error message to the logger named after the calling module.
Parameters:
msg - Message to log.
           (type=string or unicode)
Returns:
always True, so the call can be prefixed with assert.
           (type=bool)

error_n(name, msg, *args, **kwargs)

Write an error message to the logger defined through the name parameter.
Parameters:
name - Logger name to log to.
           (type=string)
msg - Message to log.
           (type=string or unicode)
Returns:
always True, so the call can be prefixed with assert.
           (type=bool)

excepthook(etype, evalue, etraceback)

Exception hook to log an exception to the "exception" logger family.
Parameters:
etype - Exception class
           (type=class)
evalue - Exception instance
           (type=instance)
etraceback - Exception traceback
           (type=traceback)

exception(msg, *args, **kwargs)

Log an exception to the logger named after the calling module.

This function can be used in a try...except block to log an exception before it is discarded.
Parameters:
msg - Message to log.
           (type=string or unicode)
Returns:
always True, so the call can be prefixed with assert.
           (type=bool)

exception_n(name, msg, *args, **kwargs)

Log an exception to the logger defined through the name parameter.

This function can be used in a try...except block to log an exception before it is discarded.
Parameters:
name - Logger name to log to.
           (type=string)
msg - Message to log.
           (type=string or unicode)
Returns:
always True, so the call can be prefixed with assert.
           (type=bool)

info(msg, *args, **kwargs)

Write an info message to the logger named after the calling module.
Parameters:
msg - Message to log.
           (type=string or unicode)
Returns:
always True, so the call can be prefixed with assert.
           (type=bool)

info_n(name, msg, *args, **kwargs)

Write an info message to the logger defined through the name parameter.
Parameters:
name - Logger name to log to.
           (type=string)
msg - Message to log.
           (type=string or unicode)
Returns:
always True, so the call can be prefixed with assert.
           (type=bool)

logged_f(func)

Decorator to activate logging for a function.

If this decorator is applied to a function, every call to that function is logged on DEBUG level.

Usage with Python 2.4 or later:
   @logged_f
   myfunction(self, foo, bar):
       :
Usage with Python 2.3:
   myfunction(self, foo, bar):
       :
   myfunction=logged_f(myfunction)
Parameters:
func - Function to put the logging wrapper around.
           (type=function)
Returns:
Function with the logging wrapper.
           (type=function)

logged_f_n(name)

Decorator to activate logging for a function using a specific logger.

If this decorator is applied to a function, every call to that function is logged on DEBUG level.

Usage with Python 2.4 or later:
   @logged_f_n('my.logger.name')
   myfunction(self, foo, bar):
       :
Usage with Python 2.3:
   myfunction(self, foo, bar):
       :
   myfunction=logged_f_n('my.logger.name')(myfunction)
Parameters:
name - Logger name to use.
           (type=string)
Returns:
A function that accepts a function as argument and returns the function with a logger wrapper around it (look at the usage example above to understand this).
           (type=function)

stack(msg, *args, **kwargs)

Write a debug message to the logger named after the calling module including information about the current call stack.

stack_n(name, msg, *args, **kwargs)

Write a debug message to the logger named after the calling module including information about the current call stack.

warning(msg, *args, **kwargs)

Write a warning message to the logger named after the calling module.
Parameters:
msg - Message to log.
           (type=string or unicode)
Returns:
always True, so the call can be prefixed with assert.
           (type=bool)

warning_n(name, msg, *args, **kwargs)

Write a warning message to the logger defined through the name parameter.
Parameters:
name - Logger name to log to.
           (type=string)
msg - Message to log.
           (type=string or unicode)
Returns:
always True, so the call can be prefixed with assert.
           (type=bool)

__caller()

__deprecated(name, func)

__enter(name, func)

__func_name(func, frame)

__leave(name, func, result)


Variable Details

_CONFIG_FILES

Type:
list
Value:
[]                                                                     


GNUe Home

Private API

Developer's Corner