Cartorio: A library for logging
Project description
1. Cartorio
A wrapper on the logging module for Python that provides a simple and easy-to-use interface for logging.
2. Contents
3. Installation
pip install cartorio
4. Documentation
https://cartorio.readthedocs.io/en/stable/
5. Usage
Consider that your project consists of two scripts:
parent.py
child/
└── child.py
An example of these scripts are:
# parent.py
from pathlib import Path
from cartorio import make_logger, log
from child.child import multiply
@log
def main()
multiply(10, 1)
if __name__ == "__main__":
# Instantiation of log file
logger, _ = make_logger(filename=Path(__file__).resolve().stem, logs_path=Path(__file__).resolve().parent)
# where,
# filename (str, Path): Log file.
# logs_path (Path): Path where the log file is saved to.
main()
# child.py
from cartorio import fun, log
@log
def multiply(num1, num2):
return num1 * num2
The log filename will be parent_<timestamp>.log and it will contain the information in the form
<timestamp> || root || 30664 || INFO || parent.py || parent || <line_number> || Enter || multiply
<timestamp> || root || 30664 || INFO || parent.py || parent || <line_number> || Leave || multiply || Elapsed: 0:00:00.001708
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 cartorio-3.0.0.tar.gz.
File metadata
- Download URL: cartorio-3.0.0.tar.gz
- Upload date:
- Size: 4.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.1 CPython/3.9.15
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
61718fb67a67e654f494c2f360ad28368cea8e91938e04261ebed81a0801c534
|
|
| MD5 |
a38eee781e28276ee754e87792a695ed
|
|
| BLAKE2b-256 |
556a7e51ae687b4c3d280faf2a2adefe7c2e654a4093d18ed2a8aceed1140fb9
|
File details
Details for the file cartorio-3.0.0-py3-none-any.whl.
File metadata
- Download URL: cartorio-3.0.0-py3-none-any.whl
- Upload date:
- Size: 5.5 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.1 CPython/3.9.15
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
0d686a8e6ab057c944ca696caaf8c546ad3dca5a3af197b9d62c94dd913fc077
|
|
| MD5 |
693b381527f3ee28e081c2b4846e105b
|
|
| BLAKE2b-256 |
7f341d579fe2b36e3de67afea496c3da9d4fa6838066c5060f536bdc20726cbf
|