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

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
N/A Built-in, lightweight, project-specific isolation <home>/.app/logged-example/log/ /var/log/logged-example/ Quick projects, CI/CD, simple teams
venv Built-in, lightweight, project-specific isolation <venv>/.app/logged-example/log/ <venv>/.app/logged-example/log/ Quick projects, CI/CD, simple teams
pyenv Manage multiple Python versions easily on one system ~/.pyenv/versions/3.12/.app/logged-example/log/ /root/.pyenv/versions/3.12/.app/logged-example/log/ Developers switching Python versions
pyenv + virtualenv Best of both worlds: version + project isolation ~/.pyenv/versions/<env-name>/.app/logged-example/log/ /root/.pyenv/versions/<env-name>/.app/logged-example/log/ Recommended for most developers
Miniconda Lightweight Conda distribution — fast, minimal, scientific-friendly ~/miniconda3/envs/<name>/.app/logged-example/log/ /root/miniconda3/envs/<name>/.app/logged-example/log/ Data science, ML, reproducible envs
Anaconda Full-featured Conda with hundreds of preinstalled packages ~/anaconda3/envs/<name>/.app/logged-example/log/ /root/anaconda3/envs/<name>/.app/logged-example/log/ 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.5.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.5-py3-none-any.whl (5.7 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: loggedexample-1.2.5.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.5.tar.gz
Algorithm Hash digest
SHA256 1bff3f319a6666a2210fb42ade6503cb20caab836096559f6bf52b18974e7c4f
MD5 6efc2c6308cda125c60958d5dec2af9d
BLAKE2b-256 ec1d42315c1fe07a101d7dd7b4d5565dca031ce1e4aff513338cc34d6926af27

See more details on using hashes here.

File details

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

File metadata

  • Download URL: loggedexample-1.2.5-py3-none-any.whl
  • Upload date:
  • Size: 5.7 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.5-py3-none-any.whl
Algorithm Hash digest
SHA256 ac4f873e90fcfbcfdf042ef59c913072683f446cfe9a02263b7660f1f2787587
MD5 9c7b6abac6c6b747833532e68c48ea34
BLAKE2b-256 23ea4d04e04fb13fb6a6398cf82833ab555ad7f4ba8f6f1d2c55803578daa7ae

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