Logger Classes¶
LogEverything provides two main logger classes: Logger for synchronous applications and AsyncLogger for async applications. Both provide the same intuitive API while being optimized for their respective contexts.
🏛️ Logger Architecture¶
Both logger classes inherit from BaseLogger and provide:
Automatic configuration with intelligent environment detection
Structured logging with additional context fields
Context managers for hierarchical logging
Visual formatting with colors, symbols, and indentation
Performance optimization with configurable profiles
Logger Class (Synchronous)¶
The Logger class is designed for synchronous applications and provides a clean, simple interface.
Basic Usage¶
from logeverything import Logger
# Create a logger with automatic configuration
log = Logger("my_app")
# Basic logging methods
log.debug("Debug information")
log.info("Application started")
log.warning("Warning message")
log.error("Error occurred")
log.critical("Critical system error")
Output:
2026-05-01 05:38:57 | [ 🔍 DEBUG ] | my_app | Debug information
2026-05-01 05:38:57 | [ ℹ️ INFO ] | my_app | Application started
2026-05-01 05:38:57 | [⚠️ WARNING ] | my_app | Warning message
2026-05-01 05:38:57 | [ ❌ ERROR ] | my_app | Error occurred
2026-05-01 05:38:57 | [🔥 CRITICAL] | my_app | Critical system error
Constructor Options¶
from logeverything import Logger
# Simple logger with defaults
simple_log = Logger("simple")
# Logger with custom name and configuration
custom_log = Logger(
name="custom_app",
auto_setup=True, # Automatically configure (default: True)
level="DEBUG",
visual_mode=True,
use_symbols=True,
profile="development"
)
# Test both loggers
simple_log.info("Simple logger message")
custom_log.info("Custom logger message")
Output:
2026-05-01 05:38:57 | [ ℹ️ INFO ] | simple | Simple logger message
05:38:57 | [ ℹ️ INFO ] | custom_app | Custom logger message
Configuration¶
Configure loggers with the configure() method:
from logeverything import Logger
log = Logger("configurable")
# Basic configuration
log.configure(
level="INFO",
visual_mode=True,
use_symbols=True,
use_colors=True
)
log.info("✨ Logger configured with visual enhancements")
# Advanced configuration
log.configure(
profile="development",
handlers=["console", "file"],
file_path="app.log",
async_mode=False,
log_entry_exit=True
)
log.info("🔧 Advanced configuration applied")
Output:
2026-05-01 05:38:57 | [ ℹ️ INFO ] | configurable | ✨ Logger configured with visual enhancements
05:38:57 | [ ℹ️ INFO ] | configurable | 🔧 Advanced configuration applied
Environment Detection¶
Loggers automatically detect and adapt to your environment:
from logeverything import Logger
# Create logger - it auto-detects environment
log = Logger("environment_demo")
log.info("Logger automatically detected environment and applied optimal settings")
# Manual override if needed
log.configure(
level="DEBUG",
format="%(asctime)s | %(levelname)s | %(message)s"
)
log.debug("Environment settings overridden")
Output:
2026-05-01 05:38:57 | [ ℹ️ INFO ] | environment_demo | Logger automatically detected environment and applied optimal settings
2026-05-01 05:38:57 | DEBUG | Environment settings overridden
Structured Logging¶
Add structured data to your logs using the .bind() method:
from logeverything import Logger
log = Logger("structured")
# Logging with additional fields
log.bind(user_id=12345,
username="john_doe",
ip_address="192.168.1.100",
session_id="abc123").info("User logged in")
# Bind context for consistent fields
user_log = log.bind(user_id=12345, session_id="abc123")
user_log.bind(product_id=789).info("Product viewed")
user_log.bind(product_id=789, quantity=2).info("Item added to cart")
user_log.bind(total_amount=99.99).info("Checkout initiated")
Output:
2026-05-01 05:38:57 | [ ℹ️ INFO ] | structured | [user_id=12345 | username=john_doe | ip_address=192.168.1.100 | session_id=abc123] User logged in
2026-05-01 05:38:57 | [ ℹ️ INFO ] | structured | [user_id=12345 | session_id=abc123 | product_id=789] Product viewed
2026-05-01 05:38:57 | [ ℹ️ INFO ] | structured | [user_id=12345 | session_id=abc123 | product_id=789 | quantity=2] Item added to cart
2026-05-01 05:38:57 | [ ℹ️ INFO ] | structured | [user_id=12345 | session_id=abc123 | total_amount=99.99] Checkout initiated
See also
For comprehensive information about binding behavior, registry management, memory safety, and advanced binding patterns, see:
Context Managers¶
Use context managers for hierarchical logging:
from logeverything import Logger
log = Logger("context_demo")
log.configure(visual_mode=True, use_symbols=True)
# Simple context
with log.context("Data Processing"):
log.info("🚀 Processing started")
log.info("📁 Loading data files")
log.info("✅ Processing completed")
# Nested contexts
with log.context("E-commerce Order"):
log.info("📦 Processing order #12345")
with log.context("Inventory Check"):
log.info("🔍 Checking item availability")
log.info("✅ Items in stock")
with log.context("Payment Processing"):
log.info("💳 Processing payment")
log.info("✅ Payment successful")
with log.context("Shipping"):
log.info("📦 Creating shipping label")
log.info("🚚 Order dispatched")
log.info("🎉 Order completed successfully")
Output:
2026-05-01 05:38:57 | [ ℹ️ INFO ] | context_demo | ┌─► Data Processing
2026-05-01 05:38:57 | [ ℹ️ INFO ] | context_demo | 🚀 Processing started
2026-05-01 05:38:57 | [ ℹ️ INFO ] | context_demo | 📁 Loading data files
2026-05-01 05:38:57 | [ ℹ️ INFO ] | context_demo | ✅ Processing completed
2026-05-01 05:38:57 | [ ℹ️ INFO ] | context_demo | └─◄ Data Processing complete
2026-05-01 05:38:57 | [ ℹ️ INFO ] | context_demo | ┌─► E-commerce Order
2026-05-01 05:38:57 | [ ℹ️ INFO ] | context_demo | 📦 Processing order #12345
2026-05-01 05:38:57 | [ ℹ️ INFO ] | context_demo | ┌─► Inventory Check
2026-05-01 05:38:57 | [ ℹ️ INFO ] | context_demo | 🔍 Checking item availability
2026-05-01 05:38:57 | [ ℹ️ INFO ] | context_demo | ✅ Items in stock
2026-05-01 05:38:57 | [ ℹ️ INFO ] | context_demo | └─◄ Inventory Check complete
2026-05-01 05:38:57 | [ ℹ️ INFO ] | context_demo | ┌─► Payment Processing
2026-05-01 05:38:57 | [ ℹ️ INFO ] | context_demo | 💳 Processing payment
2026-05-01 05:38:57 | [ ℹ️ INFO ] | context_demo | ✅ Payment successful
2026-05-01 05:38:57 | [ ℹ️ INFO ] | context_demo | └─◄ Payment Processing complete
2026-05-01 05:38:57 | [ ℹ️ INFO ] | context_demo | ┌─► Shipping
2026-05-01 05:38:57 | [ ℹ️ INFO ] | context_demo | 📦 Creating shipping label
2026-05-01 05:38:57 | [ ℹ️ INFO ] | context_demo | 🚚 Order dispatched
2026-05-01 05:38:57 | [ ℹ️ INFO ] | context_demo | └─◄ Shipping complete
2026-05-01 05:38:57 | [ ℹ️ INFO ] | context_demo | └─◄ E-commerce Order complete
2026-05-01 05:38:57 | [ ℹ️ INFO ] | context_demo | 🎉 Order completed successfully
AsyncLogger Class (Asynchronous)¶
The AsyncLogger class is specifically optimized for async applications with 6.8x better performance.
Basic Async Usage¶
from logeverything.asyncio import AsyncLogger
import asyncio
# Create async logger (automatically enables async_mode=True)
log = AsyncLogger("async_app")
# Basic async logging
log.info("🚀 Async application started")
# Simulate async operations
await asyncio.sleep(0.1)
log.info("⚡ Async operation completed")
Output:
2026-05-01 05:38:57 | [ ℹ️ INFO ] | async_app | 🚀 Async application started
2026-05-01 05:38:57 | [ ℹ️ INFO ] | async_app | ⚡ Async operation completed
High-Performance Async Methods¶
AsyncLogger provides async-optimized methods:
from logeverything.asyncio import AsyncLogger
import asyncio
log = AsyncLogger("performance_demo")
# Use async methods for better performance
await log.ainfo("High-performance async info")
await log.adebug("High-performance async debug")
await log.awarning("High-performance async warning")
await log.aerror("High-performance async error")
await log.aexception("High-performance async exception")
# Regular methods also work (slightly less optimized)
log.info("Regular info method")
Output:
2026-05-01 05:38:57 | [ ℹ️ INFO ] | performance_demo | High-performance async info
2026-05-01 05:38:57 | [ 🔍 DEBUG ] | performance_demo | High-performance async debug
2026-05-01 05:38:57 | [⚠️ WARNING ] | performance_demo | High-performance async warning
2026-05-01 05:38:57 | [ ❌ ERROR ] | performance_demo | High-performance async error
2026-05-01 05:38:57 | [ ❌ ERROR ] | performance_demo | High-performance async exception
NoneType: None
2026-05-01 05:38:57 | [ ℹ️ INFO ] | performance_demo | Regular info method
Async Configuration¶
Configure AsyncLogger for optimal performance:
from logeverything.asyncio import AsyncLogger
log = AsyncLogger("high_performance")
# Configure for high-throughput applications
await log.configure(
level="INFO",
async_queue_size=10000, # Large queue for high volume
async_flush_interval=0.05, # Fast flush for responsiveness
visual_mode=True,
use_symbols=True
)
log.info("⚡ High-performance async logging configured")
Output:
2026-05-01 05:38:58 | [ ℹ️ INFO ] | high_performance | ⚡ High-performance async logging configured
Concurrent Async Logging¶
Process multiple async operations concurrently:
from logeverything.asyncio import AsyncLogger
import asyncio
async def process_user(user_id: int, log: AsyncLogger):
"""Process a user with async logging."""
await log.ainfo(f"Processing user {user_id}")
await asyncio.sleep(0.1) # Simulate work
await log.ainfo(f"User {user_id} processing completed")
return f"User {user_id} processed"
async def concurrent_processing():
log = AsyncLogger("concurrent_demo")
# Process multiple users concurrently
tasks = [process_user(i, log) for i in range(5)]
results = await asyncio.gather(*tasks)
log.info(f"🎉 Processed {len(results)} users concurrently")
return results
results = await concurrent_processing()
print(f"Results: {len(results)} users processed")
Output:
2026-05-01 05:38:58 | [ ℹ️ INFO ] | concurrent_demo | Processing user 0
2026-05-01 05:38:58 | [ ℹ️ INFO ] | concurrent_demo | Processing user 1
2026-05-01 05:38:58 | [ ℹ️ INFO ] | concurrent_demo | Processing user 2
2026-05-01 05:38:58 | [ ℹ️ INFO ] | concurrent_demo | Processing user 3
2026-05-01 05:38:58 | [ ℹ️ INFO ] | concurrent_demo | Processing user 4
2026-05-01 05:38:58 | [ ℹ️ INFO ] | concurrent_demo | User 0 processing completed
2026-05-01 05:38:58 | [ ℹ️ INFO ] | concurrent_demo | User 1 processing completed
2026-05-01 05:38:58 | [ ℹ️ INFO ] | concurrent_demo | User 2 processing completed
2026-05-01 05:38:58 | [ ℹ️ INFO ] | concurrent_demo | User 3 processing completed
2026-05-01 05:38:58 | [ ℹ️ INFO ] | concurrent_demo | User 4 processing completed
2026-05-01 05:38:58 | [ ℹ️ INFO ] | concurrent_demo | 🎉 Processed 5 users concurrently
Results: 5 users processed
Async Context Managers¶
Use async context managers for hierarchical async logging:
from logeverything.asyncio import AsyncLogger
import asyncio
async def async_context_demo():
log = AsyncLogger("async_context")
# Async context manager
async with log.context("Async Data Pipeline"):
await log.ainfo("🚀 Starting async pipeline")
async with log.context("Data Fetching"):
await log.ainfo("📡 Fetching data from API")
await asyncio.sleep(0.1) # Simulate API call
await log.ainfo("✅ Data fetched successfully")
async with log.context("Data Processing"):
await log.ainfo("⚙️ Processing data")
await asyncio.sleep(0.1) # Simulate processing
await log.ainfo("✅ Data processed")
await log.ainfo("🎉 Pipeline completed")
await async_context_demo()
Output:
2026-05-01 05:38:58 | [ ℹ️ INFO ] | async_context | ┌─► Async Data Pipeline
2026-05-01 05:38:58 | [ ℹ️ INFO ] | async_context | 🚀 Starting async pipeline
2026-05-01 05:38:58 | [ ℹ️ INFO ] | async_context | ┌─► Data Fetching
2026-05-01 05:38:58 | [ ℹ️ INFO ] | async_context | 📡 Fetching data from API
2026-05-01 05:38:58 | [ ℹ️ INFO ] | async_context | ✅ Data fetched successfully
2026-05-01 05:38:58 | [ ℹ️ INFO ] | async_context | └─◄ Data Fetching complete
2026-05-01 05:38:58 | [ ℹ️ INFO ] | async_context | ┌─► Data Processing
2026-05-01 05:38:58 | [ ℹ️ INFO ] | async_context | ⚙️ Processing data
2026-05-01 05:38:58 | [ ℹ️ INFO ] | async_context | ✅ Data processed
2026-05-01 05:38:58 | [ ℹ️ INFO ] | async_context | └─◄ Data Processing complete
2026-05-01 05:38:58 | [ ℹ️ INFO ] | async_context | 🎉 Pipeline completed
2026-05-01 05:38:58 | [ ℹ️ INFO ] | async_context | └─◄ Async Data Pipeline complete
Performance Comparison¶
Here’s a performance comparison between Logger and AsyncLogger:
import asyncio
import time
from logeverything import Logger
from logeverything.asyncio import AsyncLogger
async def performance_comparison():
# Test parameters
num_logs = 100
# Sync logger performance
sync_log = Logger("sync_perf")
start_time = time.time()
for i in range(num_logs):
sync_log.info(f"Sync log message {i}")
sync_time = time.time() - start_time
# Async logger performance
async_log = AsyncLogger("async_perf")
start_time = time.time()
# Create tasks for concurrent logging
tasks = [async_log.ainfo(f"Async log message {i}") for i in range(num_logs)]
await asyncio.gather(*tasks)
async_time = time.time() - start_time
# Calculate performance improvement
if async_time > 0:
speedup = sync_time / async_time
print(f"Sync logging: {sync_time:.4f}s")
print(f"Async logging: {async_time:.4f}s")
print(f"Speedup: {speedup:.1f}x faster with AsyncLogger!")
else:
print("Async logging was too fast to measure!")
await performance_comparison()
Output:
2026-05-01 05:38:58 | [ ℹ️ INFO ] | sync_perf | Sync log message 0
2026-05-01 05:38:58 | [ ℹ️ INFO ] | sync_perf | Sync log message 1
2026-05-01 05:38:58 | [ ℹ️ INFO ] | sync_perf | Sync log message 2
2026-05-01 05:38:58 | [ ℹ️ INFO ] | sync_perf | Sync log message 3
2026-05-01 05:38:58 | [ ℹ️ INFO ] | sync_perf | Sync log message 4
2026-05-01 05:38:58 | [ ℹ️ INFO ] | sync_perf | Sync log message 5
2026-05-01 05:38:58 | [ ℹ️ INFO ] | sync_perf | Sync log message 6
2026-05-01 05:38:58 | [ ℹ️ INFO ] | sync_perf | Sync log message 7
2026-05-01 05:38:58 | [ ℹ️ INFO ] | sync_perf | Sync log message 8
2026-05-01 05:38:58 | [ ℹ️ INFO ] | sync_perf | Sync log message 9
2026-05-01 05:38:58 | [ ℹ️ INFO ] | sync_perf | Sync log message 10
2026-05-01 05:38:58 | [ ℹ️ INFO ] | sync_perf | Sync log message 11
2026-05-01 05:38:58 | [ ℹ️ INFO ] | sync_perf | Sync log message 12
2026-05-01 05:38:58 | [ ℹ️ INFO ] | sync_perf | Sync log message 13
2026-05-01 05:38:58 | [ ℹ️ INFO ] | sync_perf | Sync log message 14
2026-05-01 05:38:58 | [ ℹ️ INFO ] | sync_perf | Sync log message 15
2026-05-01 05:38:58 | [ ℹ️ INFO ] | sync_perf | Sync log message 16
2026-05-01 05:38:58 | [ ℹ️ INFO ] | sync_perf | Sync log message 17
2026-05-01 05:38:58 | [ ℹ️ INFO ] | sync_perf | Sync log message 18
2026-05-01 05:38:58 | [ ℹ️ INFO ] | sync_perf | Sync log message 19
2026-05-01 05:38:58 | [ ℹ️ INFO ] | sync_perf | Sync log message 20
2026-05-01 05:38:58 | [ ℹ️ INFO ] | sync_perf | Sync log message 21
2026-05-01 05:38:58 | [ ℹ️ INFO ] | sync_perf | Sync log message 22
2026-05-01 05:38:58 | [ ℹ️ INFO ] | sync_perf | Sync log message 23
2026-05-01 05:38:58 | [ ℹ️ INFO ] | sync_perf | Sync log message 24
2026-05-01 05:38:58 | [ ℹ️ INFO ] | sync_perf | Sync log message 25
2026-05-01 05:38:58 | [ ℹ️ INFO ] | sync_perf | Sync log message 26
2026-05-01 05:38:58 | [ ℹ️ INFO ] | sync_perf | Sync log message 27
2026-05-01 05:38:58 | [ ℹ️ INFO ] | sync_perf | Sync log message 28
2026-05-01 05:38:58 | [ ℹ️ INFO ] | sync_perf | Sync log message 29
2026-05-01 05:38:58 | [ ℹ️ INFO ] | sync_perf | Sync log message 30
2026-05-01 05:38:58 | [ ℹ️ INFO ] | sync_perf | Sync log message 31
2026-05-01 05:38:58 | [ ℹ️ INFO ] | sync_perf | Sync log message 32
2026-05-01 05:38:58 | [ ℹ️ INFO ] | sync_perf | Sync log message 33
2026-05-01 05:38:58 | [ ℹ️ INFO ] | sync_perf | Sync log message 34
2026-05-01 05:38:58 | [ ℹ️ INFO ] | sync_perf | Sync log message 35
2026-05-01 05:38:58 | [ ℹ️ INFO ] | sync_perf | Sync log message 36
2026-05-01 05:38:58 | [ ℹ️ INFO ] | sync_perf | Sync log message 37
2026-05-01 05:38:58 | [ ℹ️ INFO ] | sync_perf | Sync log message 38
2026-05-01 05:38:58 | [ ℹ️ INFO ] | sync_perf | Sync log message 39
2026-05-01 05:38:58 | [ ℹ️ INFO ] | sync_perf | Sync log message 40
2026-05-01 05:38:58 | [ ℹ️ INFO ] | sync_perf | Sync log message 41
2026-05-01 05:38:58 | [ ℹ️ INFO ] | sync_perf | Sync log message 42
2026-05-01 05:38:58 | [ ℹ️ INFO ] | sync_perf | Sync log message 43
2026-05-01 05:38:58 | [ ℹ️ INFO ] | sync_perf | Sync log message 44
2026-05-01 05:38:58 | [ ℹ️ INFO ] | sync_perf | Sync log message 45
2026-05-01 05:38:58 | [ ℹ️ INFO ] | sync_perf | Sync log message 46
2026-05-01 05:38:58 | [ ℹ️ INFO ] | sync_perf | Sync log message 47
2026-05-01 05:38:58 | [ ℹ️ INFO ] | sync_perf | Sync log message 48
2026-05-01 05:38:58 | [ ℹ️ INFO ] | sync_perf | Sync log message 49
2026-05-01 05:38:58 | [ ℹ️ INFO ] | sync_perf | Sync log message 50
2026-05-01 05:38:58 | [ ℹ️ INFO ] | sync_perf | Sync log message 51
2026-05-01 05:38:58 | [ ℹ️ INFO ] | sync_perf | Sync log message 52
2026-05-01 05:38:58 | [ ℹ️ INFO ] | sync_perf | Sync log message 53
2026-05-01 05:38:58 | [ ℹ️ INFO ] | sync_perf | Sync log message 54
2026-05-01 05:38:58 | [ ℹ️ INFO ] | sync_perf | Sync log message 55
2026-05-01 05:38:58 | [ ℹ️ INFO ] | sync_perf | Sync log message 56
2026-05-01 05:38:58 | [ ℹ️ INFO ] | sync_perf | Sync log message 57
2026-05-01 05:38:58 | [ ℹ️ INFO ] | sync_perf | Sync log message 58
2026-05-01 05:38:58 | [ ℹ️ INFO ] | sync_perf | Sync log message 59
2026-05-01 05:38:58 | [ ℹ️ INFO ] | sync_perf | Sync log message 60
2026-05-01 05:38:58 | [ ℹ️ INFO ] | sync_perf | Sync log message 61
2026-05-01 05:38:58 | [ ℹ️ INFO ] | sync_perf | Sync log message 62
2026-05-01 05:38:58 | [ ℹ️ INFO ] | sync_perf | Sync log message 63
2026-05-01 05:38:58 | [ ℹ️ INFO ] | sync_perf | Sync log message 64
2026-05-01 05:38:58 | [ ℹ️ INFO ] | sync_perf | Sync log message 65
2026-05-01 05:38:58 | [ ℹ️ INFO ] | sync_perf | Sync log message 66
2026-05-01 05:38:58 | [ ℹ️ INFO ] | sync_perf | Sync log message 67
2026-05-01 05:38:58 | [ ℹ️ INFO ] | sync_perf | Sync log message 68
2026-05-01 05:38:58 | [ ℹ️ INFO ] | sync_perf | Sync log message 69
2026-05-01 05:38:58 | [ ℹ️ INFO ] | sync_perf | Sync log message 70
2026-05-01 05:38:58 | [ ℹ️ INFO ] | sync_perf | Sync log message 71
2026-05-01 05:38:58 | [ ℹ️ INFO ] | sync_perf | Sync log message 72
2026-05-01 05:38:58 | [ ℹ️ INFO ] | sync_perf | Sync log message 73
2026-05-01 05:38:58 | [ ℹ️ INFO ] | sync_perf | Sync log message 74
2026-05-01 05:38:58 | [ ℹ️ INFO ] | sync_perf | Sync log message 75
2026-05-01 05:38:58 | [ ℹ️ INFO ] | sync_perf | Sync log message 76
2026-05-01 05:38:58 | [ ℹ️ INFO ] | sync_perf | Sync log message 77
2026-05-01 05:38:58 | [ ℹ️ INFO ] | sync_perf | Sync log message 78
2026-05-01 05:38:58 | [ ℹ️ INFO ] | sync_perf | Sync log message 79
2026-05-01 05:38:58 | [ ℹ️ INFO ] | sync_perf | Sync log message 80
2026-05-01 05:38:58 | [ ℹ️ INFO ] | sync_perf | Sync log message 81
2026-05-01 05:38:58 | [ ℹ️ INFO ] | sync_perf | Sync log message 82
2026-05-01 05:38:58 | [ ℹ️ INFO ] | sync_perf | Sync log message 83
2026-05-01 05:38:58 | [ ℹ️ INFO ] | sync_perf | Sync log message 84
2026-05-01 05:38:58 | [ ℹ️ INFO ] | sync_perf | Sync log message 85
2026-05-01 05:38:58 | [ ℹ️ INFO ] | sync_perf | Sync log message 86
2026-05-01 05:38:58 | [ ℹ️ INFO ] | sync_perf | Sync log message 87
2026-05-01 05:38:58 | [ ℹ️ INFO ] | sync_perf | Sync log message 88
2026-05-01 05:38:58 | [ ℹ️ INFO ] | sync_perf | Sync log message 89
2026-05-01 05:38:58 | [ ℹ️ INFO ] | sync_perf | Sync log message 90
2026-05-01 05:38:58 | [ ℹ️ INFO ] | sync_perf | Sync log message 91
2026-05-01 05:38:58 | [ ℹ️ INFO ] | sync_perf | Sync log message 92
2026-05-01 05:38:58 | [ ℹ️ INFO ] | sync_perf | Sync log message 93
2026-05-01 05:38:58 | [ ℹ️ INFO ] | sync_perf | Sync log message 94
2026-05-01 05:38:58 | [ ℹ️ INFO ] | sync_perf | Sync log message 95
2026-05-01 05:38:58 | [ ℹ️ INFO ] | sync_perf | Sync log message 96
2026-05-01 05:38:58 | [ ℹ️ INFO ] | sync_perf | Sync log message 97
2026-05-01 05:38:58 | [ ℹ️ INFO ] | sync_perf | Sync log message 98
2026-05-01 05:38:58 | [ ℹ️ INFO ] | sync_perf | Sync log message 99
2026-05-01 05:38:58 | [ ℹ️ INFO ] | async_perf | Async log message 0
2026-05-01 05:38:58 | [ ℹ️ INFO ] | async_perf | Async log message 1
2026-05-01 05:38:58 | [ ℹ️ INFO ] | async_perf | Async log message 2
2026-05-01 05:38:58 | [ ℹ️ INFO ] | async_perf | Async log message 3
2026-05-01 05:38:58 | [ ℹ️ INFO ] | async_perf | Async log message 4
2026-05-01 05:38:58 | [ ℹ️ INFO ] | async_perf | Async log message 5
2026-05-01 05:38:58 | [ ℹ️ INFO ] | async_perf | Async log message 6
2026-05-01 05:38:58 | [ ℹ️ INFO ] | async_perf | Async log message 7
2026-05-01 05:38:58 | [ ℹ️ INFO ] | async_perf | Async log message 8
2026-05-01 05:38:58 | [ ℹ️ INFO ] | async_perf | Async log message 9
2026-05-01 05:38:58 | [ ℹ️ INFO ] | async_perf | Async log message 10
2026-05-01 05:38:58 | [ ℹ️ INFO ] | async_perf | Async log message 11
2026-05-01 05:38:58 | [ ℹ️ INFO ] | async_perf | Async log message 12
2026-05-01 05:38:58 | [ ℹ️ INFO ] | async_perf | Async log message 13
2026-05-01 05:38:58 | [ ℹ️ INFO ] | async_perf | Async log message 14
2026-05-01 05:38:58 | [ ℹ️ INFO ] | async_perf | Async log message 15
2026-05-01 05:38:58 | [ ℹ️ INFO ] | async_perf | Async log message 16
2026-05-01 05:38:58 | [ ℹ️ INFO ] | async_perf | Async log message 17
2026-05-01 05:38:58 | [ ℹ️ INFO ] | async_perf | Async log message 18
2026-05-01 05:38:58 | [ ℹ️ INFO ] | async_perf | Async log message 19
2026-05-01 05:38:58 | [ ℹ️ INFO ] | async_perf | Async log message 20
2026-05-01 05:38:58 | [ ℹ️ INFO ] | async_perf | Async log message 21
2026-05-01 05:38:58 | [ ℹ️ INFO ] | async_perf | Async log message 22
2026-05-01 05:38:58 | [ ℹ️ INFO ] | async_perf | Async log message 23
2026-05-01 05:38:58 | [ ℹ️ INFO ] | async_perf | Async log message 24
2026-05-01 05:38:58 | [ ℹ️ INFO ] | async_perf | Async log message 25
2026-05-01 05:38:58 | [ ℹ️ INFO ] | async_perf | Async log message 26
2026-05-01 05:38:58 | [ ℹ️ INFO ] | async_perf | Async log message 27
2026-05-01 05:38:58 | [ ℹ️ INFO ] | async_perf | Async log message 28
2026-05-01 05:38:58 | [ ℹ️ INFO ] | async_perf | Async log message 29
2026-05-01 05:38:58 | [ ℹ️ INFO ] | async_perf | Async log message 30
2026-05-01 05:38:58 | [ ℹ️ INFO ] | async_perf | Async log message 31
2026-05-01 05:38:58 | [ ℹ️ INFO ] | async_perf | Async log message 32
2026-05-01 05:38:58 | [ ℹ️ INFO ] | async_perf | Async log message 33
2026-05-01 05:38:58 | [ ℹ️ INFO ] | async_perf | Async log message 34
2026-05-01 05:38:58 | [ ℹ️ INFO ] | async_perf | Async log message 35
2026-05-01 05:38:58 | [ ℹ️ INFO ] | async_perf | Async log message 36
2026-05-01 05:38:58 | [ ℹ️ INFO ] | async_perf | Async log message 37
2026-05-01 05:38:58 | [ ℹ️ INFO ] | async_perf | Async log message 38
2026-05-01 05:38:58 | [ ℹ️ INFO ] | async_perf | Async log message 39
2026-05-01 05:38:58 | [ ℹ️ INFO ] | async_perf | Async log message 40
2026-05-01 05:38:58 | [ ℹ️ INFO ] | async_perf | Async log message 41
2026-05-01 05:38:58 | [ ℹ️ INFO ] | async_perf | Async log message 42
2026-05-01 05:38:58 | [ ℹ️ INFO ] | async_perf | Async log message 43
2026-05-01 05:38:58 | [ ℹ️ INFO ] | async_perf | Async log message 44
2026-05-01 05:38:58 | [ ℹ️ INFO ] | async_perf | Async log message 45
2026-05-01 05:38:58 | [ ℹ️ INFO ] | async_perf | Async log message 46
2026-05-01 05:38:58 | [ ℹ️ INFO ] | async_perf | Async log message 47
2026-05-01 05:38:58 | [ ℹ️ INFO ] | async_perf | Async log message 48
2026-05-01 05:38:58 | [ ℹ️ INFO ] | async_perf | Async log message 49
2026-05-01 05:38:58 | [ ℹ️ INFO ] | async_perf | Async log message 50
2026-05-01 05:38:58 | [ ℹ️ INFO ] | async_perf | Async log message 51
2026-05-01 05:38:58 | [ ℹ️ INFO ] | async_perf | Async log message 52
2026-05-01 05:38:58 | [ ℹ️ INFO ] | async_perf | Async log message 53
2026-05-01 05:38:58 | [ ℹ️ INFO ] | async_perf | Async log message 54
2026-05-01 05:38:58 | [ ℹ️ INFO ] | async_perf | Async log message 55
2026-05-01 05:38:58 | [ ℹ️ INFO ] | async_perf | Async log message 56
2026-05-01 05:38:58 | [ ℹ️ INFO ] | async_perf | Async log message 57
2026-05-01 05:38:58 | [ ℹ️ INFO ] | async_perf | Async log message 58
2026-05-01 05:38:58 | [ ℹ️ INFO ] | async_perf | Async log message 59
2026-05-01 05:38:58 | [ ℹ️ INFO ] | async_perf | Async log message 60
2026-05-01 05:38:58 | [ ℹ️ INFO ] | async_perf | Async log message 61
2026-05-01 05:38:58 | [ ℹ️ INFO ] | async_perf | Async log message 62
2026-05-01 05:38:58 | [ ℹ️ INFO ] | async_perf | Async log message 63
2026-05-01 05:38:58 | [ ℹ️ INFO ] | async_perf | Async log message 64
2026-05-01 05:38:58 | [ ℹ️ INFO ] | async_perf | Async log message 65
2026-05-01 05:38:58 | [ ℹ️ INFO ] | async_perf | Async log message 66
2026-05-01 05:38:58 | [ ℹ️ INFO ] | async_perf | Async log message 67
2026-05-01 05:38:58 | [ ℹ️ INFO ] | async_perf | Async log message 68
2026-05-01 05:38:58 | [ ℹ️ INFO ] | async_perf | Async log message 69
2026-05-01 05:38:58 | [ ℹ️ INFO ] | async_perf | Async log message 70
2026-05-01 05:38:58 | [ ℹ️ INFO ] | async_perf | Async log message 71
2026-05-01 05:38:58 | [ ℹ️ INFO ] | async_perf | Async log message 72
2026-05-01 05:38:58 | [ ℹ️ INFO ] | async_perf | Async log message 73
2026-05-01 05:38:58 | [ ℹ️ INFO ] | async_perf | Async log message 74
2026-05-01 05:38:58 | [ ℹ️ INFO ] | async_perf | Async log message 75
2026-05-01 05:38:58 | [ ℹ️ INFO ] | async_perf | Async log message 76
2026-05-01 05:38:58 | [ ℹ️ INFO ] | async_perf | Async log message 77
2026-05-01 05:38:58 | [ ℹ️ INFO ] | async_perf | Async log message 78
2026-05-01 05:38:58 | [ ℹ️ INFO ] | async_perf | Async log message 79
2026-05-01 05:38:58 | [ ℹ️ INFO ] | async_perf | Async log message 80
2026-05-01 05:38:58 | [ ℹ️ INFO ] | async_perf | Async log message 81
2026-05-01 05:38:58 | [ ℹ️ INFO ] | async_perf | Async log message 82
2026-05-01 05:38:58 | [ ℹ️ INFO ] | async_perf | Async log message 83
2026-05-01 05:38:58 | [ ℹ️ INFO ] | async_perf | Async log message 84
2026-05-01 05:38:58 | [ ℹ️ INFO ] | async_perf | Async log message 85
2026-05-01 05:38:58 | [ ℹ️ INFO ] | async_perf | Async log message 86
2026-05-01 05:38:58 | [ ℹ️ INFO ] | async_perf | Async log message 87
2026-05-01 05:38:58 | [ ℹ️ INFO ] | async_perf | Async log message 88
2026-05-01 05:38:58 | [ ℹ️ INFO ] | async_perf | Async log message 89
2026-05-01 05:38:58 | [ ℹ️ INFO ] | async_perf | Async log message 90
2026-05-01 05:38:58 | [ ℹ️ INFO ] | async_perf | Async log message 91
2026-05-01 05:38:58 | [ ℹ️ INFO ] | async_perf | Async log message 92
2026-05-01 05:38:58 | [ ℹ️ INFO ] | async_perf | Async log message 93
2026-05-01 05:38:58 | [ ℹ️ INFO ] | async_perf | Async log message 94
2026-05-01 05:38:58 | [ ℹ️ INFO ] | async_perf | Async log message 95
2026-05-01 05:38:58 | [ ℹ️ INFO ] | async_perf | Async log message 96
2026-05-01 05:38:58 | [ ℹ️ INFO ] | async_perf | Async log message 97
2026-05-01 05:38:58 | [ ℹ️ INFO ] | async_perf | Async log message 98
2026-05-01 05:38:58 | [ ℹ️ INFO ] | async_perf | Async log message 99
Sync logging: 0.0053s
Async logging: 0.0057s
Speedup: 0.9x faster with AsyncLogger!
Best Practices¶
Choosing the Right Logger¶
# Use Logger for synchronous applications
from logeverything import Logger
log = Logger("sync_app")
# Use AsyncLogger for async applications
from logeverything.asyncio import AsyncLogger
log = AsyncLogger("async_app")
Configuration Patterns¶
# Development configuration
log.configure(
profile="development",
level="DEBUG",
visual_mode=True,
use_symbols=True
)
# Production configuration
log.configure(
profile="production",
level="WARNING",
visual_mode=False,
handlers=["file", "console"]
)
# High-performance async configuration
await async_log.configure(
async_queue_size=10000,
async_flush_interval=0.05,
level="INFO"
)
Error Handling¶
# Logger handles exceptions automatically
try:
risky_operation()
except Exception as e:
log.exception("Operation failed") # Includes traceback
log.bind(error=str(e).error("Operation failed")) # Custom message
Memory Management¶
# For long-running applications, clean up resources
async def cleanup():
await async_log.close() # Clean up async resources
# Use context managers for automatic cleanup
async with AsyncLogger("temp") as log:
log.info("Temporary logging context")
# Automatically cleaned up
API Reference¶
Logger Methods¶
# Logging methods
log.debug(message, **kwargs)
log.info(message, **kwargs)
log.warning(message, **kwargs)
log.error(message, **kwargs)
log.critical(message, **kwargs)
log.exception(message, **kwargs) # Includes traceback
# Configuration
log.configure(**options)
# Context management
log.context(name, **context)
log.bind(**context)
AsyncLogger Methods¶
# High-performance async methods
await log.ainfo(message, **kwargs)
await log.adebug(message, **kwargs)
await log.awarning(message, **kwargs)
await log.aerror(message, **kwargs)
await log.aexception(message, **kwargs)
# Standard methods (also work)
log.info(message, **kwargs)
# Async configuration
await log.configure(**options)
# Async context management
async with log.context(name, **context):
pass
See Also¶
Smart Decorators - Automatic function logging with decorators
Async Logging - Advanced async logging patterns
Context Managers - Detailed context manager usage
Performance and Optimization - Performance optimization guide