跳转到主要内容

Scribe日志写入器和日志处理程序。

项目描述

Build Status Code Climate Coverage Status License Downloads

Scribe logger

本包包含写入Scribe的低级接口,以及与Python的日志功能良好兼容的高级日志处理程序。

支持Python 2.7

安装

pip安装 scribe-logger

本地测试

git clone https://github.com/adilansari/python-scribe-logger.git
cd python-scribe-logger
pip install -U -r requirements.txt
python runtests.py

日志使用

from scribe_logger.logger import ScribeLogHandler
import logging

my_logger = logging.getLogger('MyLogger')
my_logger.setLevel(logging.DEBUG)

scribe = ScribeLogHandler('localhost', 1464, category='test_category')
scribe.setLevel(logging.DEBUG)
my_logger.addHandler(scribe)

my_logger.info('This is a test message')

默认情况下会抑制异常。使用 silent=False 来抛出它们

scribe = ScribeLogHandler('localhost', 1464, category='test_category', silent=False)

写入器使用

from scribe_logger.writer import ScribeWriter

writer = ScribeWriter('localhost', 1464, 'test_category')
try:
    writer.write('test_message_1')
    writer.write(['test_message_1', 'test_message_2', 'test_message_3'])
except ScribeLoggerError:
    raise

默认情况下会抛出异常。使用 silent=True 来抑制它们

writer = ScribeWriter('localhost', 1464, 'test_category', silent=True)
writer.write('test_message_1')
writer.write(['test_message_1', 'test_message_2', 'test_message_3'])

贡献者

@adilansari @mwhooker @lenn0x

项目详情


下载文件

下载适合您平台的文件。如果您不确定选择哪个,请了解更多关于 安装包 的信息。

源分布

scribe_logger-1.3.tar.gz (3.9 kB 查看哈希值)

上传于 源代码

支持者

AWS AWS 云计算和安全赞助商 Datadog Datadog 监控 Fastly Fastly CDN Google Google 下载分析 Microsoft Microsoft PSF赞助商 Pingdom Pingdom 监控 Sentry Sentry 错误记录 StatusPage StatusPage 状态页面