Skip to main content

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.)

  • 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.

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

balsa-0.24.0-py3-none-any.whl (18.9 kB view details)

Uploaded Python 3

File details

Details for the file balsa-0.24.0-py3-none-any.whl.

File metadata

  • Download URL: balsa-0.24.0-py3-none-any.whl
  • Upload date:
  • Size: 18.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.3

File hashes

Hashes for balsa-0.24.0-py3-none-any.whl
Algorithm Hash digest
SHA256 753a8700144dfadcb757df37f9e57a9cfe12d022f675b0a8327206e9b6d498dc
MD5 4c49fd254f1d437ebdd1c44d600f6d7a
BLAKE2b-256 10b4f9ef59bfff31dbcd5b2327d38654df27084db43f00994d20ec2c0ddafd82

See more details on using hashes here.

Release history Release notifications | RSS feed

This release

0.24.0 This release

1 file

0.23.1

1 file

0.23.0

1 file

0.21.0

1 file

0.20.1

1 file

0.19.1

1 file

0.18.0

1 file

0.16.0

1 file

0.15.0

1 file

0.14.0

1 file

0.13.0

1 file

0.12.1

1 file

0.12.0

1 file

0.11.0

1 file

0.10.1

1 file

0.10.0

1 file

0.9.3

1 file

0.9.1

1 file

0.8.1

1 file

0.8.0

1 file

0.7.3

1 file

0.7.2

1 file

0.7.1

1 file

0.7.0

1 file

0.6.7

1 file

0.6.6

1 file

0.6.5

1 file

0.6.4

1 file

0.6.3

1 file

0.6.2

1 file

0.6.1

1 file

0.6.0

1 file

0.5.0

1 file

0.4.1

1 file

0.4.0

1 file

0.3.1

1 file

0.3.0

1 file

0.2.5

1 file

0.2.1

1 file

0.2.0

1 file

0.1.2

1 file

0.1.1

1 file

0.1.0

1 file

0.0.10

1 file

0.0.9

1 file

0.0.8

1 file

0.0.7

1 file

0.0.5

1 file

0.0.4

1 file

0.0.3

1 file

0.0.2

1 file

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