Gnumed.pycommon.gmLog2

Package Gnumed :: Package pycommon :: Module gmLog2 |
[frames] | no frames]

# Module gmLog2

source code

    GNUmed logging framework setup.

    All error logging, user notification and otherwise unhandled
    exception handling should go through classes or functions of
    this module.

    Theory of operation:

    This module tailors the standard logging framework to
    the needs of GNUmed.

    By importing gmLog2 into your code you'll get the root
    logger send to a unicode file with messages in a format useful
    for debugging. The filename is either taken from the
    command line (--log-file=...) or derived from the name
    of the main application.

    The log file will be found in one of the following standard
    locations:

    1) given on the command line as "--log-file=LOGFILE"
    2) ~/.<base_name>/<base_name>.log
    3) /dir/of/binary/<base_name>.log               (mainly for DOS/Windows)

    where <base_name> is derived from the name
    of the main application.

    If you want to specify just a directory for the log file you
    must end the --log-file definition with a slash.

    By importing "logging" and getting a logger your modules
    never need to worry about the real message destination or whether
    at any given time there's a valid logger available.

    Your MAIN module simply imports gmLog2 and all other modules
    will merrily and automagically start logging away.

    Ad hoc call stack logging recipe:

            call_stack = inspect.stack()
            call_stack.reverse()
            for idx in range(1, len(call_stack)):
                    caller = call_stack[idx]
                    _log.debug('%s[%s] @ [%s] in [%s]', ' '* idx, caller[3], caller[2], caller[1])
            del call_stack

Author: K. Hilbert <Karsten.Hilbert@gmx.net>

License: GPL v2 or later (details at http://www.gnu.org)

Functions
flush() | source code
log_instance_state(instance) | source code
log_stack_trace(message=None, t=None, v=None, tb=None) | source code
log_multiline(level, message=None, line_prefix=None, text=None) | source code
add_word2hide(word) | source code

Variables
| AsciiName = ``[``'``<#0-0x00-nul>``'``,` `'``<#1-0x01-soh>``'``,` `'``<#2-0x02-stx>``'``...``
| __package__ = ``'``Gnumed.pycommon``'``

Imports: logging, sys, os, io, codecs, locale, pydt, random, time, calendar

Variables Details

  ### AsciiName Value:
      ['<#0-0x00-nul>',
       '<#1-0x01-soh>',
       '<#2-0x02-stx>',
       '<#3-0x03-etx>',
       '<#4-0x04-eot>',
       '<#5-0x05-enq>',
       '<#6-0x06-ack>',
       '<#7-0x07-bel>',
      ...