Skip to main content

A logging example application with sudo detection and log rotation

Project description

LoggedExample

LoggedExample is a clean, minimal demonstration application built to showcase ChronicleLogger — a high-performance, POSIX-compliant, cross-version (Python 2.7 & 3.x) logging utility with daily rotation, automatic archiving (tar.gz >7 days), old log removal (>30 days), privilege-aware paths (/var/log for root, ~/.app for users), and smart environment detection (venv, pyenv, pyenv-virtualenv, Miniconda/Anaconda).

ChronicleLogger is available on PyPI: https://pypi.org/project/ChronicleLogger/

LoggedExample PyPI: https://pypi.org/project/LoggedExample/

Current version: 1.1.1

Features

  • Uses ChronicleLogger for structured, timestamped logging: [YYYY-MM-DD HH:MM:SS] pid:<PID> [<LEVEL>] @<COMPONENT> :] <MESSAGE>
  • Automatically adapts log/base directory based on:
    • Active Python environment (venv / pyenv / pyenv-virtualenv / miniconda)
    • User privileges (root vs non-root)
  • Debug mode (DEBUG=show) displays complete logger + environment information
  • Simple CLI interface (LoggedExample info)
  • Zero external dependencies beyond ChronicleLogger
  • Ready for development, containers, or system services

Installation

Quick install (global or current environment)

pip install LoggedExample

Run:

LoggedExample info
# With full debug output:
DEBUG=show LoggedExample info

Recommended: Use an isolated environment

LoggedExample (powered by ChronicleLogger) detects the active Python environment and places logs inside it — usually under <env>/.app/logged-example/log/ or ~/.app/logged-example/log/.


Environment Guide: Purpose, Installation & Usage (2025)

Environment Purpose Log Location (non-root) Log Location (root) Best For
venv Built-in, lightweight, project-specific isolation <venv>/.app/logged-example/log/ /var/log/logged-example/ Quick projects, CI/CD, simple teams
pyenv Manage multiple Python versions easily on one system ~/.pyenv/versions/3.12/.app/logged-example/log/ /var/log/logged-example/ Developers switching Python versions
pyenv + virtualenv Best of both worlds: version + project isolation ~/.pyenv/versions/<env-name>/.app/logged-example/log/ /var/log/logged-example/ Recommended for most developers
Miniconda Lightweight Conda distribution — fast, minimal, scientific-friendly ~/miniconda3/envs/<name>/.app/logged-example/log/ /var/log/logged-example/ Data science, ML, reproducible envs
Anaconda Full-featured Conda with hundreds of preinstalled packages ~/anaconda3/envs/<name>/.app/logged-example/log/ /var/log/logged-example/ Beginners in data/science, heavy deps

1. venv (standard Python virtual environment)

python3 -m venv logged-env
source logged-env/bin/activate

pip install LoggedExample

DEBUG=show LoggedExample info

2. pyenv (multiple Python versions)

pyenv install 3.12
pyenv global 3.12               # or pyenv local 3.12

pip install LoggedExample

DEBUG=show LoggedExample info

3. pyenv + virtualenv plugin (recommended)

pyenv virtualenv 3.12 logged-example-env
pyenv activate logged-example-env

pip install LoggedExample

DEBUG=show LoggedExample info

4. Miniconda (lightweight Conda)

conda create -n logged-example python=3.12
conda activate logged-example

pip install LoggedExample

DEBUG=show LoggedExample info

5. Anaconda (full distribution)

conda create -n logged-example python=3.12
conda activate logged-example

pip install LoggedExample

DEBUG=show logged-example info

Root / System-wide Usage

sudo -E DEBUG=show logged-example info          # via sudo → user home
sudo su -                                       # real root
DEBUG=show LoggedExample info                  # → /var/log/logged-example/

Development / From Source

git clone https://github.com/yourusername/logged-example.git
cd logged-example

pyenv virtualenv 3.12 logged-example-dev
pyenv activate logged-example-dev

pip install -e .

License

MIT

Made with ❤️ using ChronicleLogger — happy logging!

Project details


Download files

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

Source Distribution

loggedexample-1.2.1.tar.gz (5.3 kB view details)

Uploaded Source

Built Distribution

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

loggedexample-1.2.1-py3-none-any.whl (5.6 kB view details)

Uploaded Python 3

File details

Details for the file loggedexample-1.2.1.tar.gz.

File metadata

  • Download URL: loggedexample-1.2.1.tar.gz
  • Upload date:
  • Size: 5.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.12

File hashes

Hashes for loggedexample-1.2.1.tar.gz
Algorithm Hash digest
SHA256 16911d8131445b3dcb89269f0f976ed1841a15c8a107b8cd132edb1492871509
MD5 06b512780e40e82b08a27c4a61cc1714
BLAKE2b-256 8e496d224af3e80d32d967ad590ab4ee1b99ce54260d0f1bccae993a5bd440cf

See more details on using hashes here.

File details

Details for the file loggedexample-1.2.1-py3-none-any.whl.

File metadata

  • Download URL: loggedexample-1.2.1-py3-none-any.whl
  • Upload date:
  • Size: 5.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.12

File hashes

Hashes for loggedexample-1.2.1-py3-none-any.whl
Algorithm Hash digest
SHA256 170a930adaa586da6f7bbbf106c55cbf251ba3a02f5026e39d2f310d23b7c360
MD5 724b1fab1a1c9402b00dba047d484e3f
BLAKE2b-256 556d87159f45e063910c533bff04964dc2ec50f52e4c83e7251f01c548fe2ccb

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page