Skip to main content


Pylogfile provides a better method for implementing logging in your Python scripts.

Core features:

  • automatically includes metadata such as timestamps.
  • supports optional detail strings to supplement the main log message.
  • integrated markdown makes it easy to highlight parts of log messages with color.
  • easily read and write logs to binary files for better efficiency, or JSON and TXT for best readability.
  • standardized format makes it easy to read previous log files, simplifying sorting and analysis.
  • script lumberjack makes viewing, sorting and analyzing log files quick and easy.

Pylogfile is designed to be a better option than the Python standard logging module for simple to intermediate-complexity logging tasks. For professional applications in which you want to add custom logging handlers, the standard module is the better choice. However, for the majority of scripts, especially in the scientific, engineering and data analysis domains, pylogfile offers loads of capability and a much faster way of setting up proper logging than the standard module. With pylogfile, your application has access to efficient data management and display through the addition of detailed messages, integrated markdown, and log search functions through the lumberjack script.

Installation

Pylogfile can be installed via pip using

pip install pylogfile

Example usage

In this example, we create a simple program that sends two log messages and saves them to disk. Here we show how to save to both binary and plain text formats. .plflog files are binary (HDF5 under the hood), allowing logs to be saved faster and while using less space on disk. We also show how to save to a JSON file, for those who prefer the simplicity of plain text files; JSON files carry the exact same data (log entries plus log level definitions) as a .plflog file, just in a more verbose, human-readable form.

from pylogfile.base import *

log = LogPile()
log.info("Something happened. Emphasize >this<.")
log.error("Something bad happened!")

log.save_plflog("example.log.plflog")
log.save_json("example.log.json")

With the corresponding output:

Lumberjack

Lumberjack is a command line interface (CLI) script included with pylogfile that allows log files to quickly be viewed, sorted, and analyzed. A log file can be opened in lumberjack with:

lumber example.log.plflog

and the first few logs displayed with the SHOW command:

Basic information about the log file can be displayed with the INFO command.

Logs can also be sorted by applying flags to the SHOW command. Here the --index flag is used to search based on the index of the log entry, the --contains flag is used to search for the keyword or phrase 'RF' while specifying a max of 5 logs should be displayed using the --num flag, and the log level is filter by applying the --min and --max flags.

Lumberjack has lots of other search functions, commands, and features. You can learn more about it from its integrated help menu which can list all available commands and provide detailed information on how to use them.

Documentation

Pylogfile's documentation can be found on ReadTheDocs.

Requirements

  • Python >= 3.9
  • numpy >= 1.21.0
  • h5py >= 3.11.0
  • colorama >= 0.4.6
  • importlib >= 1.0.0

Download files

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

Source Distribution

pylogfile-0.5.0.tar.gz (46.5 kB view details)

Uploaded Source

Built Distribution

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

pylogfile-0.5.0-py3-none-any.whl (28.0 kB view details)

Uploaded Python 3

File details

Details for the file pylogfile-0.5.0.tar.gz.

File metadata

  • Download URL: pylogfile-0.5.0.tar.gz
  • Upload date:
  • Size: 46.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/7.0.0 CPython/3.14.3

File hashes

Hashes for pylogfile-0.5.0.tar.gz
Algorithm Hash digest
SHA256 66624630d48cfd5bda9380bdbd4601e81b66558c34b80e1df824f6fb44ce0ce7
MD5 1689c04a632b85ae691a81597a5829cc
BLAKE2b-256 45c9e5ecd5d344da49c9649cafe6ee59bda57d75e5b2f460d537b2ef96de5f45

See more details on using hashes here.

File details

Details for the file pylogfile-0.5.0-py3-none-any.whl.

File metadata

  • Download URL: pylogfile-0.5.0-py3-none-any.whl
  • Upload date:
  • Size: 28.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/7.0.0 CPython/3.14.3

File hashes

Hashes for pylogfile-0.5.0-py3-none-any.whl
Algorithm Hash digest
SHA256 903fc9e3e5095af79084d64a1f22f09b99458efbab0184d9c1a608007a208074
MD5 bc05458f326f9dc7a31ff01f5b8c5cd8
BLAKE2b-256 36f0603eb93fa7aa0dfb5772dc9e2a1684a6e8cc98847d5b19314ac58a423dd8

See more details on using hashes here.

Release history Release notifications | RSS feed

This release

0.5.0 This release

2 files

0.4.1

2 files

0.4.0

2 files

0.3.2

2 files

0.3.1

2 files

0.3.0

2 files

0.2.3

2 files

0.2.2

2 files

0.2.1

2 files

0.2.0

2 files

0.1.0

2 files

0.0.1

2 files

0.0.0

2 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