A logging library for Python
Project description
Log4p日志库
描述
这是一个可以支持异步记录日志,发送到HTTP,websocket服务器,同时配置简单,它还实现了识别代码异步和同步的环境 以支持不同环境下的日志记录,当然了,理论上,这个日志如果2个模式都启用(websocket,http),那么会分别的往2个地方发送日志
示例用法
#from core import *
from SparkleLogging.utils.core import LogManager
from logging import Formatter
logger = LogManager().GetLogger(
log_name='example',
out_to_console=True,
web_log_mode=True,
WSpost_url='ws://localhost:8765',
HTTPpost_url='http://localhost:8765',
http_mode = True,
custom_fomatter=Formatter('%(asctime)s - %(name)s - %(levelname)s - %(message)s',datefmt="%H:%M:%S")
)
logger.info('这是一个成功信息')
logger.debug('这是一个调试信息')
logger.critical('这是一个严重错误信息')
logger.error('这是一个错误信息')
logger.warning('这是一个警告信息')
参数介绍
log_name
: 指定日志记录器的名称out_to_console
: 是否输出到控制台,默认trueweb_log_mode
:是否启用websocket日志输出模式,默认falseWSpost_url
: 如果启用websocket模式,则传入post_url,否则不管,默认NoneHTTPpost_url
: 如果启用http模式,则传入post_url,否则不管,默认Nonehttp_mode
: 是否启用http日志输出模式,默认false
更新日志
2024/2/20 1:01
更新了自定义格式功能,修复了少量bug
添加参数
custom_formatter
: 自定义格式化函数,默认None
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
SparkleLogging-1.0.2.tar.gz
(5.7 kB
view details)
Built Distribution
File details
Details for the file SparkleLogging-1.0.2.tar.gz
.
File metadata
- Download URL: SparkleLogging-1.0.2.tar.gz
- Upload date:
- Size: 5.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.0.0 CPython/3.12.2
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | c4aeb8e85f00888595860ff8eed9a6048dd93a520221a4c3e532b50ed604b52f |
|
MD5 | 26a37ee4ee60519036970fd508809d2a |
|
BLAKE2b-256 | 1ebb32f94c65c694df4401213923435a7157037e89172c5c97d9da506272151c |
File details
Details for the file SparkleLogging-1.0.2-py3-none-any.whl
.
File metadata
- Download URL: SparkleLogging-1.0.2-py3-none-any.whl
- Upload date:
- Size: 6.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.0.0 CPython/3.12.2
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 622c956f558d6442f6b45ed4240b4b7a0e3ed5b5b882d8ab3589e10cbf8e2a89 |
|
MD5 | 807c05eeeffd30e820f4b9c91c8f4644 |
|
BLAKE2b-256 | 9765d9a942b18841a2ba8cbf9c6e83fc56b094b3c09bc5c30e50cee4fd3d28d0 |