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 > System > Logging

    Logbook 0.4.1

    Download button

    No screenshots available
    Downloads: 208  Tell us about an update
    User Rating:
    Rated by:
    NOT RATED
    0 user(s)
    Developer:

    License / Price:

    Last Updated:

    Category:
    Armin Ronacher and Georg Brandl | More programs
    BSD License / FREE
    October 24th, 2010, 00:48 GMT
    ROOT / System / Logging

     Read user reviews (0)  Refer to a friend  Subscribe

    Logbook description

    A logging replacement for Python

    Logbook is an awesome logging implementation that is fun to use.

    Quickstart

    from logbook import Logger
    log = Logger('A Fancy Name')

    log.warn('Logbook is too awesome for most applications')
    log.error("Can't touch this")

    Works for web apps too

    from logbook import MailHandler, Processor

    mailhandler = MailHandler(from_addr='servererror@example.com',
     recipients=['admin@example.com'],
     level='ERROR', format_string=u'''\
    Subject: Application Error for {record.extra[path]} [{record.extra[method]}]

    Message type: {record.level_name}
    Location: {record.filename}:{record.lineno}
    Module: {record.module}
    Function: {record.func_name}
    Time: {record.time:%Y-%m-%d %H:%M:%S}
    Remote IP: {record.extra[ip]}
    Request: {record.extra[path]} [{record.extra[method]}]


    Message:

    {record.message}
    ''')

    def handle_request(request):
     def inject_extra(record, handler):
     record.extra['ip'] = request.remote_addr
     record.extra['method'] = request.method
     record.extra['path'] = request.path

     with Processor(inject_extra):
     with mailhandler:
     # execute code that might fail in the context of the
     # request.



    Product's homepage

    Requirements:

    · Python

      


    TAGS:

    logging replacement | Python logging | Python | logging | logger

    Go to top

    WindowsGamesDriversMacLinuxScriptsMobileHandheldNews

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