balsa (logging utility)
Simple to use package that sets up Python logging. With just a few lines of code get well formatted logging to the console, log file, popup windows and exception services.
Here is a short Presentation on Balsa.
Installation
pip install balsa
Major Features
Simple to use. Add full-featured Python logging in just a few lines of code.
Sane default log levels. Single verbose flag. (All levels can be overridden if desired, e.g. console_log_level.)
Both console (stdout) and GUI (popup window) support.
Log file support. Uses appdirs for log file paths.
Structured logging via yasf.sf() (optional - you can still use simple strings).
Sentry support. Just provide your Sentry DSN. Set the BALSA_DEV environment variable to keep development-time errors out of Sentry.
Sentry structured logs support. Set use_sentry_logs to send log records to Sentry as searchable, first-class log entries (requires sentry-sdk 2.35+).
Informative log message formatting (or you can change it if you like).
ISO 8601 timestamp format (with fractional seconds).
Cross platform (Windows, Linux, macOS). Pure Python.
Multiprocessing support.
AWS CloudWatch logs support. Structured logs enable CloudWatch Logs Insights.
Optional error callback, e.g. to notify the user or exit on any error.
In-memory buffer of recent log lines via Balsa.get_string_list().
Simple Example
from balsa import get_logger, Balsa
application_name = 'example'
log = get_logger(application_name)
def main():
balsa = Balsa(application_name, 'james abel')
balsa.init_logger()
log.error('my error example')
if __name__ == '__main__':
main()
This will yield output of this form:
2021-10-24T10:49:04.150790-07:00 - example - MainProcess - balsa_simple_example.py - 12 - main - ERROR - my error example
More examples are in the examples directory.
Where did the name come from?
Balsa lumber is very soft and light, with a coarse, open grain. The Balsa package is light weight, malleable, and open source.
Release files for balsa 0.25.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| balsa-0.25.0-py3-none-any.whl | Python 3 | none | any | Details |
Release files / balsa-0.25.0-py3-none-any.whl
| Download URL | balsa-0.25.0-py3-none-any.whl |
|---|---|
| Size | 19.0 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
3743c3a61a3ccf8da8f5a54f1a252a4f0cbf7f7c5d43a8549895fb0f853e250a
|
|
BLAKE2b-256 checksum How to use checksums |
0780734a59a675fe033eb7109dcab11f58af34ca33a26b9d12be78b75dea4bfc
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.14.3
|