jmj / scribehandler Goto Github PK
View Code? Open in Web Editor NEWScribe Handler for python logging
License: GNU General Public License v2.0
Scribe Handler for python logging
License: GNU General Public License v2.0
ScribeHandler is a simple proxy layer that works with the python standard logging module (http://docs.python.org/library/logging.html). 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 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')
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.