Skip to main content

A colorful and feature-rich logging library for Python

Project description

logfore

A colorful, feature-rich logging library for Python with support for styled output, loading animations, ASCII banners, and auto-updates.

Installation

pip install logfore

Quick Start

from logfore import Logger, Loader, Home, LogLevel

# Basic logger (colorful style)
log = Logger(prefix="MyApp")

log.info("Application started")
log.success("Task completed")
log.warning("Low memory")
log.failure("Connection lost")
log.error("Something went wrong")
log.debug("Debug message")
log.critical("Fatal error occurred")  # exits program

# Simple/minimal style
log2 = Logger(style=2, prefix="MyApp")
log2.info("Simple style log")

Features

Logger Styles

Style Description
style=1 Colorful logger with pink/cyan/magenta theme (default)
style=2 Minimal simple logger with arrow prefix

Logger Options

log = Logger(
    style=1,                          # 1 = ColorLogger, 2 = SimpleLogger
    prefix="MyApp",                   # Prefix shown in brackets
    github_repository="user/repo",    # Displays repo info on start
    level=LogLevel.DEBUG,             # Minimum log level to display
    log_file="logs/app.log"           # Optional file logging
)

Log Levels

from logfore import LogLevel

# Available levels (in order):
LogLevel.DEBUG
LogLevel.INFO
LogLevel.WARNING
LogLevel.SUCCESS
LogLevel.FAILURE
LogLevel.CRITICAL

Timing Support

All log methods support optional timing:

import time

start = time.time()
# ... do work ...
end = time.time()

log.success("Done!", start=start, end=end)
# Output: ... [Success] -> Done! In 1.234 Seconds

Loading Spinner

from logfore import Loader

# As context manager
with Loader(prefix="MyApp", desc="Processing...", end="Done!"):
    time.sleep(2)

# Manual control
loader = Loader(desc="Loading...")
loader.start()
# ... do work ...
loader.stop()

ASCII Banner (Home Screen)

from logfore import Home

home = Home(
    text="LOGFORE",
    align="center",       # "left", "center", "right"
    adinfo1="v1.0.0",
    adinfo2="by Author",
    credits="GitHub: user",
    clear=True            # Clear terminal before display
)
home.display()

Auto Updater

from logfore import AutoUpdater, Logger

log = Logger()
updater = AutoUpdater("your-pypi-package-name", log)
updater.check_for_updates()

File Logging

log = Logger(log_file="logs/myapp.log")
log.info("This is saved to file too")

Questions / Input

answer = log.question("What is your name? ")
print(f"Hello, {answer}!")

Requirements

  • Python 3.10+
  • colorama
  • pystyle
  • requests
  • packaging

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

logfore-2.1.3.1.tar.gz (10.9 kB view details)

Uploaded Source

Built Distribution

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

logfore-2.1.3.1-py3-none-any.whl (9.9 kB view details)

Uploaded Python 3

File details

Details for the file logfore-2.1.3.1.tar.gz.

File metadata

  • Download URL: logfore-2.1.3.1.tar.gz
  • Upload date:
  • Size: 10.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.11.9

File hashes

Hashes for logfore-2.1.3.1.tar.gz
Algorithm Hash digest
SHA256 64173c86d64af796c8cd49664c3b776545c8bd50635dc7ee6f09e31bbeeda14a
MD5 1e8be7e7b8ab14f7872db12912893ad2
BLAKE2b-256 c5b622b59fd14c12fce9fefaa2b3574d3724396b2faf02140f27115ccb6d9f3f

See more details on using hashes here.

File details

Details for the file logfore-2.1.3.1-py3-none-any.whl.

File metadata

  • Download URL: logfore-2.1.3.1-py3-none-any.whl
  • Upload date:
  • Size: 9.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.11.9

File hashes

Hashes for logfore-2.1.3.1-py3-none-any.whl
Algorithm Hash digest
SHA256 acbbab258d75f7e6b65416e628e8d9314e715d3fc2bad2b3537e6c840111f180
MD5 89f9be4fb83df8af736e851ff62183d3
BLAKE2b-256 0ce3d2be8e1e75d30b331c6ecdc7e250cc8c8cfba7073db3cd60e562318d235e

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