@@ -224,13 +224,19 @@ logger.warning("High memory usage") # WARNING not in notify_levels
224224# Custom level and color
225225logger.custom("Deploy completed", "DEPLOY", "purple")
226226
227- # Structured logging with key-value data
228- logger.dir ("User action",
227+ # Structured logging with key-value data using any log method
228+ logger.info ("User action",
229229 user_id="123",
230230 action="login",
231231 ip_address="192.168.1.1",
232232 success=True
233233)
234+
235+ # Works with all log levels
236+ logger.error("Database connection failed", host="localhost", port=5432, timeout=30)
237+ logger.success("Payment processed", amount=99.99, currency="USD", method="credit_card")
238+ logger.warning("High memory usage", memory_pct=85, threshold=80)
239+ logger.critical("System overload", cpu_pct=95, memory_pct=98)
234240```
235241
236242### Advanced Notification Usage
@@ -381,7 +387,7 @@ def log_request(request):
381387 start_time = time.time()
382388
383389 # Log request details
384- logger.dir ("Request started",
390+ logger.info ("Request started",
385391 request_id=request_id,
386392 method=request.method,
387393 path=request.path,
@@ -392,7 +398,7 @@ def log_request(request):
392398 response = process(request)
393399 duration = time.time() - start_time
394400
395- logger.dir ("Request completed",
401+ logger.info ("Request completed",
396402 request_id=request_id,
397403 status=response.status_code,
398404 duration_ms=round(duration * 1000)
@@ -422,7 +428,7 @@ logger = Tamga(
422428
423429# Add service context to all logs
424430def log_with_context(message, level="info"):
425- logger.dir (message,
431+ logger.info (message,
426432 service=service_name,
427433 version=os.getenv("VERSION"),
428434 instance=os.getenv("INSTANCE_ID")
@@ -575,7 +581,7 @@ logger = Tamga(
575581
576582# Application usage
577583logger.info("Application starting")
578- logger.dir ("Configuration loaded",
584+ logger.info ("Configuration loaded",
579585 environment=os.getenv("ENV"),
580586 debug_mode=True
581587)
0 commit comments