def log(msg, **kwargs):
    """Generic log method. Will prepend timestamp.

    Keyword arguments:
      system   - Name of the system/module
      indent   - Integer denoting the desired level of indentation
      streams  - List of streams to output to
      stream   - Stream to output to (singleton version of streams)
    """
    if 'debug' in kwargs:
        if 'currentdebug' in kwargs:
            if kwargs['currentdebug'] < kwargs['debug']:
                return False
        else:
            return False #no currentdebug passed, assuming no debug mode and thus skipping message

    s = "[" + datetime.datetime.now().strftime("%Y-%m-%d %H:%M:%S") + "] "
    if 'system' in kwargs:
        s += "[" + system + "] "


    if 'indent' in kwargs:
        s += ("\t" * int(kwargs['indent']))

    s += u(msg)

    if s[-1] != '\n':
        s += '\n'

    if 'streams' in kwargs:
        streams = kwargs['streams']
    elif 'stream' in kwargs:
        streams = [kwargs['stream']]
    else:
        streams = [stderr]

    for stream in streams:
        stream.write(s)
    return s
def log ( msg , ** kwargs ) : if 'debug' in kwargs : if 'currentdebug' in kwargs : if kwargs [ 'currentdebug' ] < kwargs [ 'debug' ] : return False else : return False s = "[" + datetime . datetime . now ( ) . strftime ( "%Y-%m-%d %H:%M:%S" ) + "] " if 'system' in kwargs : s += "[" + system + "] " if 'indent' in kwargs : s += ( "\t" * int ( kwargs [ 'indent' ] ) ) s += u ( msg ) if s [ - 1 ] != '\n' : s += '\n' if 'streams' in kwargs : streams = kwargs [ 'streams' ] elif 'stream' in kwargs : streams = [ kwargs [ 'stream' ] ] else : streams = [ stderr ] for stream in streams : stream . write ( s ) return s
Generic log method. Will prepend timestamp.

    Keyword arguments:
      system   - Name of the system/module
      indent   - Integer denoting the desired level of indentation
      streams  - List of streams to output to
      stream   - Stream to output to (singleton version of streams)