Softpedia
 


LINUX CATEGORIES:



GLOBAL PAGES >>
NEWS ARCHIVE >>
SOFTPEDIA REVIEWS >>
MEET THE EDITORS >>
WEEK'S BEST
  • Linux Kernel 3.9.3 / 3....
  • LibreOffice 3.6.6 / 4.0.3
  • MPlayer 1.1.1
  • systemd 204
  • Arch Linux 2013.05.01
  • Blender 2.67a
  • KDE Software Compilatio...
  • CrunchBang Linux Stable...
  • Elementary OS 0.1 / 0.2...
  • SystemRescueCd 3.6.0
  • Home > Linux > Internet > Proxy

    ScribeHandler 0.05

    Download button

    No screenshots available
    Downloads: 230  View global page NEW!  Tell us about an update
    User Rating:
    Rated by:
    NOT RATED
    0 user(s)
    Developer:

    License / Price:

    Last Updated:

    Category:
    Jeremy Jones | More programs
    GPL / FREE
    May 17th, 2011, 21:16 GMT
    ROOT / Internet / Proxy

     Read user reviews (0)  Refer to a friend  Subscribe

    ScribeHandler description

    A simple proxy layer that works with the Python standard logging module

    ScribeHandler is a simple proxy layer that works with the python standard logging module. It 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 defaults):

    Argument            Default
    ---------------------------
    host                127.0.0.1
    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
        None
    - 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
        loggername      logging.LogRecord.name
        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')
    mylogger.setLevel(logging.DEBUG)
    handler = ScribeHandler.ScribeHandler(category='%(hostname)s-%(levelname)s', file_buffer='/tmp/logbuffer')
    mylogger.addHandler(handler)

    mylogger.debug('stuff happens')



    Product's homepage

    Requirements:

    · Python

      


    TAGS:

    proxy layer | Python logging | Python | proxy | layer

    Go to top

    WindowsGamesDriversMacLinuxScriptsMobileHandheldNews

    SUBMIT PROGRAM   |   ADVERTISE   |   GET HELP   |   SEND US FEEDBACK   |   RSS FEEDS   |   UPDATE YOUR SOFTWARE   |   ROMANIAN FORUM