> ## Documentation Index
> Fetch the complete documentation index at: https://docs.otter-shell.org/llms.txt
> Use this file to discover all available pages before exploring further.

# Logging

> Scoped loggers, counters, timers, and reporters in otter-utils.

Zero-allocation logging with scoped component tags. Counters and timers help profile daemon hot paths.

## Scoped logger

```zig theme={null}
const log = @import("otter_utils").log;

const mylog = log.Scoped("my-component");
mylog.info("starting up", .{});
mylog.debug("value: {}", .{42});
mylog.err("something failed", .{});
```

Log level follows the app's build mode and any global filter the app sets.

## Performance helpers

```zig theme={null}
var counter = log.Counter{};
counter.inc();
counter.add(5);
const total = counter.reset();

var timer = log.Timer{};
timer.begin();
// ... work ...
const elapsed_ms = timer.elapsedMs();

var reporter = log.Reporter("perf", 30).init();
if (reporter.shouldReport()) |elapsed| {
    // emit periodic metrics
}
```

Use `Reporter` in bar daemons and collectors that should not spam logs every frame.
