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
Release history Release notifications | RSS feed
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.2.tar.gz
(11.0 kB
view details)
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
logfore-2.1.3.2-py3-none-any.whl
(10.0 kB
view details)
File details
Details for the file logfore-2.1.3.2.tar.gz.
File metadata
- Download URL: logfore-2.1.3.2.tar.gz
- Upload date:
- Size: 11.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.11.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
73644750596a6ac1df8f98a02d87192bb55dafb56be808e817ed33494ceb5b18
|
|
| MD5 |
6f7a35b2582b7e253b398ec6375f7a81
|
|
| BLAKE2b-256 |
78f33d17961a0dd048a572fd17834ead44a6cb533292019e9c26f52bd6518447
|
File details
Details for the file logfore-2.1.3.2-py3-none-any.whl.
File metadata
- Download URL: logfore-2.1.3.2-py3-none-any.whl
- Upload date:
- Size: 10.0 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.11.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
bf213e5394247eae5fd8031ee93140be078da8e2a5371fac508ede61df501dea
|
|
| MD5 |
c04848650595599f6f8b9120d1d3fd43
|
|
| BLAKE2b-256 |
e37de1c8666bfd564c864b84bdd6353e527a6a80e96ac9c28ae3804cfd0988f1
|