A simple logging tool
Project description
Bilogger 铋日志 一个简洁好用的log工具
© BiNb9O3 Stdio 2022 ##主体部分 导入: 下载Bilogger.py文件到你的项目目录,并在项目文件中导入Bilogger
import Bilogger as bl
介绍文件中所有Bilogger会以bl出现
**information_and_copyright函数在调用后会输出有关本工具的信息 **
bl.information_and_copyright()
settingDefault函数在调用后会修改日日志器的设置
示例: time=1 控制输出日志时是否输出时间 type="INFO" 输出日志时的日志类型 message="Default Message" 日志默认信息,如果调用日志器什么都不传入的话会输出此信息 speaker="Test Thread"输出日志的线程 speaker_display=1 控制输出日志时是否输出调用线程信息 type_display=1 控制输出日志时是否输出类型 color 控制颜色
bl.settingDefault(time=1, type="INFO", message="Default Message", speaker="Test Thread", speaker_display=1, type_display=1, color="red")
此时再输出设置:
print(bl.logger_setting) {'time': 1, 'speaker_display': 1, 'type_display': 1, 'type': 'INFO', 'message': 'Default Message', 'speaker': 'Test Thread', 'color': 'red'}
如果什么参数都不带,则会回到默认设置:
bl.settingDefault()
此时再输出设置:
print(bl.logger_setting) {'time': 1, 'speaker_display': 1, 'type_display': 1, 'type': 'INFO', 'message': 'No message input,please check the value of logger', 'speaker': 'Main Program', 'color': 'Normal'}
logger函数是日志器,传入参数时可以只传入message,color可以传入颜色(所有字母小写):
- red:红色
- green:绿色
- Normal:白色
- yellow:黄色
- gw:绿色背景 白色文字
其余参数来自于默认设置,所有输出的日志内容会被记录在logs列表内 不传入任何参数:
bl.logger()
输出日志:
[2022-12-01 12:20:30][INFO][Main Program]No message input,please check the value of logger
也可以传入部分参数来修改日志内容:
bl.logger(time=0,speaker="Test Thread",message="Hello world!")
输出日志:
[INFO][Test Thread]Hello world!
outputlogs函数会将所有日志信息存储到dir传参中的文件夹内,文件名为当前的时间,后缀名为filetype传参。
filetype:无需“.” dir:只传入文件夹,不传入文件名!!!!!!!!!
如果尝试写入失败,则会发出警告 如果成功就会清空logs列表,从新开始记录
bl.outputLogs(dir="./logs",filetype="log")
outputSettings 函数可以导出本次Bilogger的设置,dir只传入文件夹! 如果尝试写入失败,则会发出警告
bl.outputSettings(dir="./settings")
inputSettings函数可以导入Bilogger设置,dir传入文件的路径。 如果尝试读取失败,则会发出警告
bl.inputSettings(dir="./settings/BiloggerSettings.json")
##附带的小工具
endl函数名来源于C++库iostream中cout的用法,表示换行,调用后会输出转义字符\n
bl.endl()
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
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file Bilogger_Bi2Nb9O3-0.0.1.tar.gz.
File metadata
- Download URL: Bilogger_Bi2Nb9O3-0.0.1.tar.gz
- Upload date:
- Size: 18.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.8.5
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
cd2c948a52bf211b1fb982545d50005aae07730740a55e36bb95dbed1fc8614e
|
|
| MD5 |
e03e0c96b0e7edd0338e9d75be104f84
|
|
| BLAKE2b-256 |
3af64b01fa44c541061f52ed4d7e01920ddd094bb8079882ff475162e9db6d99
|
File details
Details for the file Bilogger_Bi2Nb9O3-0.0.1-py3-none-any.whl.
File metadata
- Download URL: Bilogger_Bi2Nb9O3-0.0.1-py3-none-any.whl
- Upload date:
- Size: 16.4 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.8.5
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
abb54d2ed2033c1bf08303f9ed8be6c04dd75aa719eebe2325d6ae71c937caf6
|
|
| MD5 |
a7b14354e50d9818da050b0039fbd927
|
|
| BLAKE2b-256 |
eb8558dd52bf4b38ba59952324b94c2e88f8bd2308207ce4878a3351db55777e
|