| name | usage-logging |
| description | Implements structured usage logging and audit trails for cost and session tracking. Use when adding audit trails, usage analytics, or cost tracking to a skill. |
| alwaysApply | false |
| category | infrastructure |
| tags | ["logging","usage","audit","metrics","sessions","analytics"] |
| dependencies | [] |
| tools | [] |
| provides | {"infrastructure":["usage-logging","session-management","audit-trails"],"patterns":["structured-logging","metrics-collection","cost-tracking"]} |
| usage_patterns | ["audit-logging","cost-tracking","usage-analytics","session-management"] |
| complexity | beginner |
| model_hint | fast |
| estimated_tokens | 450 |
| progressive_loading | true |
| modules | ["modules/session-patterns.md","modules/log-formats.md"] |
Table of Contents
Usage Logging
Overview
Records individual call costs and usage events. For aggregate budget
enforcement, use quota-management.
Session-aware logging infrastructure for tracking operations across plugins.
Provides structured JSONL logging with automatic session management for
audit trails and analytics.
When To Use
- Need audit trails for operations
- Tracking costs across sessions
- Building usage analytics
- Debugging with operation history
When NOT To Use
- Simple operations without logging needs
Core Concepts
Session Management
Sessions group related operations:
- Auto-created on first operation
- Timeout after 1 hour of inactivity
- Unique session IDs for tracking
Log Entry Structure
{
"timestamp": "2025-12-05T10:30:00Z",
"session_id": "session_1733394600",
"service": "my-service",
"operation": "analyze_files",
"tokens":