https://bugzilla.wikimedia.org/show_bug.cgi?id=48846

Ori Livneh <o...@wikimedia.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |o...@wikimedia.org

--- Comment #15 from Ori Livneh <o...@wikimedia.org> ---
(In reply to comment #14)
> There is of course no python module for this

Bzzt! http://docs.python.org/2/library/logging.handlers.html#datagramhandler


    # -*- coding: utf-8 -*-
    from __future__ import unicode_literals

    import logging
    import logging.handlers

    class ToolLabsHandler(logging.handlers.DatagramHandler):
        def makePickle(self, record):
            return 's {0.name} 1 {0.msg}'.format(record).encode('utf-8',
errors='replace')



    if __name__ == '__main__':
        # If invoked as standalone, perform self-test.
        log = logging.getLogger('my_tool_name')
        log.setLevel(logging.INFO)
        handler = ToolLabsHandler('localhost', 64386)
        log.addHandler(handler)
        log.info('Hello, world.')

-- 
You are receiving this mail because:
You are on the CC list for the bug.
_______________________________________________
Wikibugs-l mailing list
Wikibugs-l@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/wikibugs-l

Reply via email to