Skip to main content

hogwarts-logger

what

hogwarts-logger,一个专门方便pycharm查看的log库。

why

为了方便霍格沃兹学社的测试开发教学,开发了一个方便打印日志的库

where 特点

  • 可以打印pycharm直接点击到源文件位置的路径提示
  • 可以打印上下log之间的耗时
  • 可以打印函数调用链 function call trace

how

项目级别logger

默认使用包名作为日志名字,适合项目中统一使用。

from hogwarts_logger import Logger

logger = Logger.get_instance()

实例级别logger

允许创建多种Logger

from hogwarts_logger import Logger

logger1 = Logger()
logger2 = Logger()

便捷使用

from hogwarts_logger import *

trace('trace message')
debug('debug message')
info('info message')

日志级别

from hogwarts_logger import Logger

logger = Logger()
logger.set_level(logger.trace_level)
logger.trace('trace')
logger.log('trace')
logger.debug('debug')
logger.info('info')
logger.warn('warn')

default 默认级别

info
warn

info级别

test_path_log.py:199:test_info_level 2025-03-23 03:47:05,971 I info
test_path_log.py:200:test_info_level 2025-03-23 03:47:05,972 W warn

debug级别

test_path_log.py:188:test_debug_level:0.00  2025-03-23 03:47:05,968 D debug
test_path_log.py:189:test_debug_level:0.00  2025-03-23 03:47:05,969 I info
test_path_log.py:190:test_debug_level:0.00  2025-03-23 03:47:05,969 W warn

trace级别

test_path_log.py:177:pytest_pyfunc_call:test_trace_level:0.00 2025-03-23 03:47:05,965 L trace
test_path_log.py:178:pytest_pyfunc_call:test_trace_level:0.00 2025-03-23 03:47:05,966 D debug
test_path_log.py:179:pytest_pyfunc_call:test_trace_level:0.00 2025-03-23 03:47:05,966 I info
test_path_log.py:180:pytest_pyfunc_call:test_trace_level:0.00 2025-03-23 03:47:05,967 W warn

who

Release files for ceshiren-logger 1.0.4

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for ceshiren-logger 1.0.4
File Size Uploaded
ceshiren_logger-1.0.4.tar.gz 6.3 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for ceshiren-logger 1.0.4
File Interpreter ABI Platform
ceshiren_logger-1.0.4-py3-none-any.whl Python 3 none any Details

Total release size: 12.4 kB

Release files / ceshiren_logger-1.0.4.tar.gz

Download URL ceshiren_logger-1.0.4.tar.gz
Size 6.3 kB
Tags Source
SHA-256 checksum
How to use checksums
72bed4605baff5f40886e199f758f4ff5ffc8daba288f8c5889bc5439e5db6de
BLAKE2b-256 checksum
How to use checksums
de94e96539765626162d59a76dcfe3993ef39e04d424a4c76cedc3189de2bc1b
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.12

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Jun 10, 2026.

Transparency log

Release files / ceshiren_logger-1.0.4-py3-none-any.whl

Download URL ceshiren_logger-1.0.4-py3-none-any.whl
Size 6.1 kB
Tags Python 3
SHA-256 checksum
How to use checksums
19c0ff009c1e3d087e4a8c63d93b1cc6938f4a25af2f5f8002fbb94fefc26e39
BLAKE2b-256 checksum
How to use checksums
fac176e3b6e903aace8c1171792e26874f0d37dcaccfc786cb72780f2e75932c
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.12

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Jun 10, 2026.

Transparency log

Release history Release notifications | RSS feed

This release

1.0.4 This release

2 release files

1.0.2

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page