Scribe Handler for python logging

License: GPL-2.0

Language: Python

ScribeHandler is a simple proxy layer that works with the python standard
logging module (  ScribeHandler
acts a a handler object that gets added to a logger in the standard way.

Important bits:

When instantiating the handler, you will want to specify the connection
setting to scribed.  The following keyword arguments are reconized (and

Argument            Default
port                1463
category            %(hostname)s-%(loggername)s
transport           ScribeHandler.FRAMED
uri                 None

- Host and port, should be obvious

- If transport is ScribeHandler.FRAMED, then
    thrift.transport.TTransport.TFramedTransport() is used.
- If transport is ScribeHandler.BUFFERED, then
    thrift.transport.TTransport.TBufferedTransport() is used.
- If transport is ScribeHandler.HTTP then
    thrift.transport.THttpClient.THttpClient() is used and uri MUST NOT be
- If transport is None then you can assign any acceptable Thrift/Scribe
    transport via 

        ScirbeHandler.transport = <transport>

    where <transport> is a valid Scibe/Thrift transport (this is an attempt at
    future proofing).

- category is translated into the category parameter to scribe.LogEntry()
    object.  It should be a standard format string using mapping keys.
    The following are the reconized mapping keys:

    Key Name        Source
    module          logging.LogRecord.module
    levelname       logging.LogRecord.levelname
    processname     logging.LogRecord.processName
    hostname        socket.gethostname()

Here's a simple example of how to use it:

import logging
import ScribeHandler
mylogger = logging.getLogger('ScribeLogger')
handler = ScribeHandler.ScribeHandler(category='%(hostname)s-%(levelname)s', file_buffer='/tmp/logbuffer')

mylogger.debug('stuff happens')

Project Statistics

Sourcerank 4
Repository Size 501 KB
Stars 15
Forks 3
Watchers 2
Open issues 0
Dependencies 0
Contributors 2
Tags 0
Last updated
Last pushed

Top Contributors See all

Jeremy Jones macie-korte

Packages Referencing this Repo

ScribeHandler is a simple proxy layer that works with the python standard logging module
Latest release 0.05 - Updated - 15 stars

Interesting Forks See all

Scribe Handler for python logging
Python - GPL-2.0 - Last pushed - 1 stars

Something wrong with this page? Make a suggestion

Last synced: 2016-05-27 17:24:16 UTC

Login to resync this repository