A package for atomic evaluation tools and utilities
Project description
Core features
Log data as tables, and then render them as entries in web log viewer with extremely simple functions !
from best_logger import *
# === log nested dictionaries as table ===
print_dictofdict({
'sample-1':{
"a": 1,
"b": 2,
"c": 3,
},
'sample-2':{
"a": 4,
"b": 5,
"c": 6,
}
}, narrow=True, header="this is a header", mod="", attach="create a copy button in web log viewer, when clicked, copy this message into clipboard")
# ╭─────────────── this is a header ───────────────╮
# │ ┏━━━━━━━━━━━━━━━━━━━━━━┳━━━━━━━┳━━━━━━┳━━━━━━┓ │
# │ ┃ ┃ a ┃ b ┃ c ┃ │
# │ ┡━━━━━━━━━━━━━━━━━━━━━━╇━━━━━━━╇━━━━━━╇━━━━━━┩ │
# │ │ sample-1 │ 1 │ 2 │ 3 │ │
# │ ├──────────────────────┼───────┼──────┼──────┤ │
# │ │ sample-2 │ 4 │ 5 │ 6 │ │
# │ └──────────────────────┴───────┴──────┴──────┘ │
# ╰────────────────────────────────────────────────╯
# === log a list of dictionaries as table ===
print_listofdict(
[{
"a": 1,
"b": 2,
"c": 3,
},
{
"a": 4,
"b": 5,
"c": 6,
}], narrow=True)
# ╭────────────────────────────────────────────────╮
# │ ┏━━━━━━━━━━━┳━━━━━━━━━━┳━━━━━━━━━━┳━━━━━━━━━━┓ │
# │ ┃ ┃ a ┃ b ┃ c ┃ │
# │ ┡━━━━━━━━━━━╇━━━━━━━━━━╇━━━━━━━━━━╇━━━━━━━━━━┩ │
# │ │ 0 │ 1 │ 2 │ 3 │ │
# │ ├───────────┼──────────┼──────────┼──────────┤ │
# │ │ 1 │ 4 │ 5 │ 6 │ │
# │ └───────────┴──────────┴──────────┴──────────┘ │
# ╰────────────────────────────────────────────────╯
# === log dictionary as table ===
print_dict({
"a": 1,
"b": 2,
"c": 3,
}, mod="abc")
# ╭────────────────────────────────────────────────╮
# │ ┌──────────────────────┬─────────────────────┐ │
# │ │ a │ 1 │ │
# │ ├──────────────────────┼─────────────────────┤ │
# │ │ b │ 2 │ │
# │ ├──────────────────────┼─────────────────────┤ │
# │ │ c │ 3 │ │
# │ └──────────────────────┴─────────────────────┘ │
# ╰────────────────────────────────────────────────╯
Quick Start
-
install:
pip install beast-logger -i https://pypi.org/simple -
import
from best_logger import *
-
register file handler
def register_logger(mods=[], non_console_mods=[], base_log_path="logs", auto_clean_mods=[]): """ mods: 需要注册的模块名列表,同时向终端和文件输出 non_console_mods: 需要注册的模块名列表,只向文件输出 base_log_path: 日志文件存放的根目录 auto_clean_mods: 需要自动删除旧日志的模块名列表 """
-
begin logging
from best_logger import * register_logger(mods=["abc"]) print_dict({ "a": 1, "b": 2, "c": 3, }, mod="abc")
-
install nvm
wget -qO- https://raw.githubusercontent.com/nvm-sh/nvm/v0.40.3/install.sh | bash -
launch web display on port 8181 (first time)
python -m web_display.install 8181 -
launch web display on port 8181 (skip npm install)
python -m web_display.go 8181 -
open in browser
http://localhost:8181
- test program and enter log dir (absolute path) into web log viewer.
from best_logger import * register_logger(mods=["abc"]) print_dict({ "a": 1, "b": 2, "c": 3, }, mod="abc")
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 beast_logger-0.0.4.tar.gz.
File metadata
- Download URL: beast_logger-0.0.4.tar.gz
- Upload date:
- Size: 585.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.11.11
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
59a36808737ba78d33abc1e26dfdad56071a1b948df88c2fe5e7db8451b506f8
|
|
| MD5 |
be8cb5b49a4bb7e93da6edc4b90bd449
|
|
| BLAKE2b-256 |
badc2e0efc17c27e9c392f5c2b3ddabe67992197ab6acc719b7c3c2ceace0a1d
|
File details
Details for the file beast_logger-0.0.4-py3-none-any.whl.
File metadata
- Download URL: beast_logger-0.0.4-py3-none-any.whl
- Upload date:
- Size: 592.6 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.11.11
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
0cec96d9108f70e608d83bb34433d83347289f53277819354d587064c94846be
|
|
| MD5 |
de955a73be6aee9433e3f6d73d543545
|
|
| BLAKE2b-256 |
767946a55e4eb0f0f49aa47c05e6bf79dc6804764831e8e1453ed3215190cbdb
|