Roi Rav-Hon 74f2f37718 | 9 years ago | |
---|---|---|
logzio | 9 years ago | |
LICENSE | 9 years ago | |
README.md | 9 years ago | |
setup.cfg.py | 9 years ago | |
setup.py | 9 years ago |
Python handler that sends logs in bulk over https to logz.io. The handler use an internal buffer, and you can choose the drain timeout, and the number of messages to hold in queue before drain. Everything is working in threads, and they would exit after completing draining all the logs if the main program exits.
pip install logzio-python-handler
[handlers]
keys=LogzioHandler
[handler_LogzioHandler]
class=logzio.handler.LogzioHandler
formatter=jsonFormat
args=('token', 10, 20)
[formatters]
keys=jsonFormat
[loggers]
keys=root
[logger_root]
handlers=LogzioHandler
level=INFO
[formatter_jsonFormat]
format={ "loggerName":"%(name)s", "functionName":"%(funcName)s", "lineNo":"%(lineno)d", "levelName":"%(levelname)s", "message":"%(message)s"}
args=() arguments, by order
import logging
import logging.config
# Say i have saved my configuration under ./myconf.conf
logging.config.fileConfig('myconf.conf')
logger = logging.getLogger('superAwesomeLogzioLogger')
logger.info('Test log')
logger.warn('Warning')
try:
1/0
except:
logger.exception("Supporting exceptions too!")
TBD