A developer-experience toolkit disguised as a logging library.
Fast Logger gives you zero-config, dependency-free logging with built-in debugging superpowers: rich tracebacks with heuristic fix suggestions, one-line framework integrations, session recording & export, a full CLI toolkit, and themes — all out of the box.
| Feature | logging |
loguru |
fast-logger |
|---|---|---|---|
| Zero config | ❌ | ✅ | ✅ |
| Zero dependencies | ✅ | ❌ | ✅ |
| Enhanced tracebacks + diagnostics | ❌ | ❌ | ✅ |
| One-line framework plugins | ❌ | ❌ | ✅ |
Decorators (@catch, @trace, @profile) |
❌ | Partial | ✅ |
| Session record & export (HTML/MD) | ❌ | ❌ | ✅ |
| TUI log viewer & CLI toolkit | ❌ | ❌ | ✅ |
| Built-in themes | ❌ | ❌ | ✅ |
| Secret masking | Custom | Custom | Built-in |
| Built-in async logging | Manual | ✅ | ✅ |
# Core — zero dependencies
pip install python-fast-logger
# With beautiful Rich terminal output (recommended)
pip install "python-fast-logger[rich]"
# With TUI interactive viewer
pip install "python-fast-logger[tui]"from fast_logger import FastLogger
logger = FastLogger() # zero-config, name defaults to "app"
logger.info("Server started")
logger.warning("Memory usage high")
logger.error("Connection refused")Or the classic one-liner:
from fast_logger import quick_logger
logger = quick_logger("my_app")logger = FastLogger("api", json_format=True)
logger.info("Request processed")
# {"timestamp": "2026-07-10T19:00:00", "level": "INFO", "logger": "api", "message": "Request processed"}Non-blocking logging with QueueHandler/QueueListener — safe for multithreaded and async applications:
logger = FastLogger("worker", async_safe=True)logger = FastLogger(
"app",
max_file_size_mb=100,
backup_count=5,
compress_backups=True, # gzip old log files
)Automatically redact passwords, API keys, and tokens from your logs:
logger = FastLogger("secure", mask_secrets=True)
logger.info("Connecting with password='super_secret_password'")
# Output: Connecting with password='********'logger = FastLogger("app", theme="cyberpunk") # neon blue/pink/yellow
logger = FastLogger("app", theme="dracula") # classic Dracula palette
logger = FastLogger("app", theme="minimal") # monochrome, no icons
logger = FastLogger("app", theme="default") # clean, professionalAvailable themes: default, cyberpunk, dracula, minimal
Inject persistent context (request IDs, user IDs) into every subsequent log:
ctx_logger = logger.bind(request_id="req-123", user_id=42)
ctx_logger.info("Processing payment")
# {"message": "Processing payment", "request_id": "req-123", "user_id": 42, ...}with logger.timer("Database query"):
results = db.execute("SELECT * FROM users")
# [INFO] Database query took 142.30ms@logger.trace(level="DEBUG")
def fetch_data(url: str):
return requests.get(url)
# [DEBUG] ENTER fetch_data()
# [DEBUG] EXIT fetch_data() took 312.45ms@logger.profile()
def compute():
return sum(range(10_000_000))
# [INFO] compute() completed in 0.1234s | Memory: +1.2 MiBlogger.watch("config", {"debug": True, "db_host": "localhost"})
logger.diff(old_config, new_config)All of these degrade gracefully to plain text if rich is not installed:
# Beautiful tables
logger.table([{"name": "Alice", "role": "Admin"}, {"name": "Bob", "role": "User"}])
# Tree structures
logger.tree("Config", {"database": {"host": "localhost", "port": 5432}, "cache": {"ttl": 300}})
# JSON pretty-printing
logger.json({"status": "ok", "latency_ms": 42})
# SQL syntax highlighting
logger.sql("SELECT * FROM users WHERE id = 42")
# HTTP request/response inspection
logger.http(response)
# Object inspection
logger.inspect(my_object)
# Styled panels
logger.panel("Anomaly detected in checkout flow", title="AI Agent")
# Markdown rendering
logger.markdown("# Deployment Report\n- ✅ All tests passed\n- ⚠️ 2 deprecation warnings")
# Progress bars
with logger.progress() as progress:
task = progress.add_task("Processing", total=100)
for i in range(100):
progress.advance(task)
# cURL command generation
logger.curl({"method": "POST", "url": "https://api.example.com/v1/users", "headers": {"Authorization": "Bearer ..."}})logger.catch() gives you Rust-style diagnostics — not just a traceback, but why it happened and how to fix it:
with logger.catch("Processing user data"):
users = fetch_users()
admin = users[999] # IndexErrorOutput:
╭─ Exception ──────────────────────────────────────────╮
│ IndexError │
│ list index out of range │
╰──────────────────────────────────────────────────────╯
╭─ Traceback ──────────────────────────────────────────╮
│ app.py:42 process() │
│ admin = users[999] │
╰──────────────────────────────────────────────────────╯
╭─ Diagnostics ────────────────────────────────────────╮
│ Likely Causes │ Suggested Fixes │
│ • Loop exceeded list │ ✓ Add bounds check │
│ length │ ✓ Use enumerate() │
│ • Off-by-one error │ ✓ Don't mutate while │
│ │ iterating │
╰──────────────────────────────────────────────────────╯
Supports 15+ exception types: ConnectionRefusedError, KeyError, ImportError, AttributeError, FileNotFoundError, TimeoutError, RecursionError, ZeroDivisionError, TypeError, ValueError, PermissionError, MemoryError, and more.
IDE Hyperlinks: File paths in tracebacks are clickable OSC 8 terminal links (VS Code, PyCharm, iTerm2).
One-line integrations. All plugins are optional — they only activate if the target library is installed:
# Option A: Auto-patch all new FastAPI instances
logger.use("fastapi")
# Option B: Patch an existing app
logger.patch_fastapi(app)Automatically logs: request method, path, status code, latency, correlation ID (X-Request-ID), and exceptions.
logger.patch_flask(app)
# or
logger.use("flask", app)Logs: incoming requests, response status, latency, and request IDs via before_request / after_request hooks.
logger.patch_redis(redis_client)
# or
logger.use("redis", redis_client)Logs every Redis command with latency:
Redis GET user:42 → 3.2ms
logger.patch_openai()
# or
logger.use("openai")Automatically logs: model name, input/output tokens, estimated cost (USD), and latency:
OpenAI gpt-4o | in=1200 out=350 tokens | $0.006500 | 1823ms
logger.patch_celery(celery_app)
# or
logger.use("celery", celery_app)Logs task lifecycle via Celery signals: started, finished (with duration), failed (with exception), retrying.
logger.patch_requests()
# or
logger.use("requests")Automatically logs all outgoing requests calls with method, URL, status code, and latency.
logger.use("sqlalchemy")Logs SQL queries and execution times.
Record your debugging sessions and export them for bug reports:
# Start recording
logger.record()
# ... do your debugging ...
logger.info("Investigating issue #42")
logger.error("Found the bug!")
# Save session
logger.save("bug.fl")
# Export to HTML (beautiful dark-themed, searchable report)
logger.export_html("bug.fl")
# Export to Markdown (paste into GitHub Issues)
logger.export_markdown("bug.fl")fastlogger replay bug.flfastlogger ui bug.flThe fastlogger CLI ships with every installation:
# Environment health check
fastlogger doctor
# Scaffold a config file
fastlogger init
# Log file stats (level counts, top messages)
fastlogger stats app.log
# Real-time colorized tailing
fastlogger tail logs/app.log
# Session replay with original timing
fastlogger replay bug.fl
# Interactive TUI log viewer (requires textual)
fastlogger ui bug.fl
# Gantt chart timeline from session files
fastlogger timeline bug.fl
# Benchmark fast-logger vs logging vs loguru
fastlogger benchmark# Synchronous timeline
with logger.timeline("Database migration"):
run_migrations()
# [INFO] Timeline [Database migration] END (2.341s)
# Async timeline
async with logger.async_timeline("LLM call"):
response = await openai_client.chat.completions.create(...)
# [INFO] Async Timeline [LLM call] END (1.823s)
# OpenTelemetry spans (if opentelemetry is installed)
with logger.span("checkout-flow"):
process_checkout()logger.sysinfo()Dumps OS, Python version, hostname, CPU count, memory usage, and container detection (Docker/K8s).
from fast_logger import FastLogger
logger = FastLogger(
name="my_app",
level="DEBUG",
log_folder="custom_logs",
max_file_size_mb=100,
backup_count=5,
console_output=True,
json_format=True,
async_safe=True,
mask_secrets=True,
compress_backups=True,
color_output=True,
theme="dracula",
pretty_exceptions=True,
)logger = FastLogger.from_config("fast_logger.json")Generate a starter config with fastlogger init.
| Parameter | Type | Default | Description |
|---|---|---|---|
name |
str |
"app" |
Logger name (also used as log filename) |
level |
str/int |
INFO |
Logging level |
log_folder |
str |
"logs" |
Directory for log files |
max_file_size_mb |
int |
50 |
Max size per log file |
backup_count |
int |
3 |
Number of rotated backups |
console_output |
bool |
True |
Log to terminal |
json_format |
bool |
False |
Structured JSON output |
color_output |
bool |
True |
ANSI colors in terminal |
async_safe |
bool |
False |
Thread-safe QueueHandler |
mask_secrets |
bool |
False |
Auto-redact sensitive data |
compress_backups |
bool |
False |
Gzip rotated log files |
theme |
str |
"default" |
Color theme name |
pretty_exceptions |
bool |
True |
Rich traceback formatting |
base_path |
str |
Caller's dir | Base directory for logs |
log_format |
str |
Default | Custom format string |
debug(), info(), success(), warning(), error(), critical(), exception()
bind(), timer(), trace(), profile(), catch(), watch(), diff()
table(), tree(), json(), sql(), http(), inspect(), panel(), markdown(), progress(), curl(), benchmark()
use(), patch_fastapi(), patch_flask(), patch_redis(), patch_openai(), patch_celery(), patch_requests()
record(), save(), export_html(), export_markdown()
timer(), timeline(), async_timeline(), span(), sysinfo(), screenshot()
- Python 3.9+
- Zero required dependencies — everything works with the standard library
| Package | Enables |
|---|---|
rich |
Beautiful terminal rendering, syntax highlighting, panels |
textual |
Interactive TUI log viewer (fastlogger ui) |
Pillow |
Screenshot capture (logger.screenshot()) |
psutil |
Enhanced system telemetry in sysinfo() |
opentelemetry-api |
Distributed tracing with logger.span() |
If fast-logger has saved you time or helped your project, please consider supporting its development.
- ⭐ Star this repository — it helps others discover fast-logger
- ☕ Buy me a coffee
- ❤️ Sponsor on GitHub
MIT License. See LICENSE for details.