LiteLog
LiteLog is an easy-to-use, totally standard-library Python logging utility that makes complex logging functions easy.
Features
automatically-named per-file logfiles, specifically written next to the source files.
special __debug__ log, where tagged functions can have all of their input/output/errors safely reported completely transparently and without interference.
different log message levels, just like the ‘logging’ builtin.
recursive calls in __debug__ are indented, so determining function call depth is natural.
Installation
To install globally, run:
sudo pip install litelog
To install locally (such as within a virtual environment), run:
pip install litelog
Usage
The following is copy-and-pasteable code, so long as litelog is available globally:
####################################
# SETTING UP THE LOGGER
import os
import litelog
ROOTPATH = os.path.splitext(__file__)[0]
LOGPATH = "{0}.log".format(ROOTPATH) # this simply specifies the absolute path -- feel free to change this.
LOGGER = litelog.get(__name__, path=LOGPATH)
LOGGER.info("----------BEGIN----------")
# do the following step if you want
# a global 'debug' log file:
litelog.set_debug(__file__)
####################################
When pasted at the top of your program, the above lines:
create a logger specifically for the current file, with the same name (ex: test.py -> test.log)
add a starting line/delimiter to the log, to indicate separate module imports/runs (by default, the logs are appended to)
creates an optional global “debug” logger, which can record the I/O/Errors of any function tagged with ‘@litelog.logwrap’ (set_debug() should only be called once)
Here are the actual use case examples:
@litelog.logwrap # <--- do this if you want a __debug__.log to record I/O/Error of function calls
def f():
...
LOGGER.info('just a test') # <--- do this if you want to log custom
# messages to the script's personal log.
####################################
# logging levels:
LOGGER.debug (...)
LOGGER.info (...)
LOGGER.warning (...)
LOGGER.error (...)
LOGGER.critical(...)
Metadata
Release files for litelog 0.2.6
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | |
|---|---|---|---|---|
| litelog-0.2.6.tar.gz | 5.7 kB | Without provenance | Details |
Release files / litelog-0.2.6.tar.gz
| Download URL | litelog-0.2.6.tar.gz |
|---|---|
| Size | 5.7 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
f703ce9449a5233019f10cecdb1495c07f709ab50b0d036aef0730f5fe999687
|
|
BLAKE2b-256 checksum How to use checksums |
af8f5502d2e1ba5ad2efb57fd93d3e3acfd8fc4ef2d11c2e1312b190ed763779
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
Security for litelog 0.2.6
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.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.