• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

coder / slog
96%

Build:
DEFAULT BRANCH: main
Repo Added 05 Jan 2022 12:31PM UTC
Token RwaFMiyeLjsSbbPvnzRlCGnFaUGTPofYK regen
Build 169 Last
Files 12
Badge
Embed ▾
README BADGES
x

If you need to use a raster PNG badge, change the '.svg' to '.png' in the link

Markdown

Textile

RDoc

HTML

Rst

LAST BUILD ON BRANCH main
branch: main
CHANGE BRANCH
x
Reset
Sync Branches
  • main
  • TERM-4389
  • add-log-buffer-sink
  • callum/human-perf
  • calm-sublogger
  • chore/dependency-security-updates
  • colin/fix-ci
  • colin/otel
  • colin/revert
  • colin/sync-test-logs
  • colin/update-all-deps
  • colin/x-term
  • dependabot/go_modules/cloud.google.com/go-0.100.1
  • dependabot/go_modules/cloud.google.com/go-0.100.2
  • dependabot/go_modules/cloud.google.com/go-0.107.0
  • dependabot/go_modules/cloud.google.com/go-0.108.0
  • dependabot/go_modules/cloud.google.com/go-0.109.0
  • dependabot/go_modules/cloud.google.com/go-0.110.2
  • dependabot/go_modules/cloud.google.com/go/compute-1.10.0
  • dependabot/go_modules/cloud.google.com/go/compute-1.11.0
  • dependabot/go_modules/cloud.google.com/go/compute-1.12.1
  • dependabot/go_modules/cloud.google.com/go/compute-1.13.0
  • dependabot/go_modules/cloud.google.com/go/compute-1.14.0
  • dependabot/go_modules/cloud.google.com/go/compute-1.6.1
  • dependabot/go_modules/cloud.google.com/go/compute-1.7.0
  • dependabot/go_modules/cloud.google.com/go/compute-1.8.0
  • dependabot/go_modules/cloud.google.com/go/compute-1.9.0
  • dependabot/go_modules/cloud.google.com/go/logging-1.19.0
  • dependabot/go_modules/cloud.google.com/go/logging-1.19.1
  • dependabot/go_modules/github.com/alecthomas/chroma-0.10.0
  • dependabot/go_modules/github.com/charmbracelet/lipgloss-0.9.1
  • dependabot/go_modules/github.com/fatih/color-1.14.0
  • dependabot/go_modules/github.com/fatih/color-1.14.1
  • dependabot/go_modules/github.com/google/go-cmp-0.5.7
  • dependabot/go_modules/github.com/google/go-cmp-0.5.8
  • dependabot/go_modules/github.com/google/go-cmp-0.5.9
  • dependabot/go_modules/github.com/google/go-cmp-0.6.0
  • dependabot/go_modules/github.com/muesli/termenv-0.15.2
  • dependabot/go_modules/go.opencensus.io-0.24.0
  • dependabot/go_modules/go.opentelemetry.io/otel/trace-1.19.0
  • dependabot/go_modules/golang.org/x/crypto-0.10.0
  • dependabot/go_modules/golang.org/x/crypto-0.11.0
  • dependabot/go_modules/golang.org/x/crypto-0.9.0
  • dependabot/go_modules/golang.org/x/net-0.17.0
  • dependabot/go_modules/golang.org/x/term-0.12.0
  • dependabot/go_modules/golang.org/x/term-0.13.0
  • dependabot/go_modules/golang.org/x/term-0.14.0
  • dependabot/go_modules/golang.org/x/term-0.44.0
  • dependabot/go_modules/golang.org/x/term-0.45.0
  • dependabot/go_modules/google.golang.org/grpc-1.57.1
  • dependabot/go_modules/google.golang.org/grpc-1.82.1
  • dependabot/go_modules/google.golang.org/grpc-1.83.1
  • dependabot/go_modules/otel-19afbd04db
  • dependabot/go_modules/otel-526f66d0b0
  • dependabot/go_modules/otel-87141668d4
  • dependabot/go_modules/otel-b6fd91a875
  • dependabot/go_modules/otel-be7620059b
  • dependabot/go_modules/otel-da2746b111
  • dk/err-formatting
  • ethan/handle-sql-types-slogjson
  • fix-stackdriver
  • fix/syncwriter-stderr-corruption
  • human
  • kvapi
  • mafredri-patch-1
  • mafredri/safer-istty
  • nuke-cf1b
  • refs/heads/main
  • refs/pull/184/merge
  • refs/pull/185/merge
  • refs/pull/186/merge
  • refs/pull/188/merge
  • refs/pull/189/merge
  • refs/pull/190/merge
  • refs/pull/194/merge
  • refs/pull/198/merge
  • spike/dont-panic
  • spike/ignore-context-canceled
  • spike/ignore-error-fn
  • spike/v3
  • terrastruct

18 Sep 2026 10:42PM UTC coverage: 96.08% (+0.05%) from 96.034%
a4f439e455e1db7c96c91b1c24bd5ca561e2df89

push

github

web-flow
feat: add FlightRecorder sink for deferred low-level logging (#237)

* feat: add Buffer sink for deferred low-level logging

Buffer is a Sink that holds entries below a configured level in a
fixed-size in-memory ring, forwarding entries at or above the level
immediately. Flush replays the buffered entries to the wrapped sinks.

This lets a program run its logger at LevelDebug to capture verbose
entries while only emitting them on demand (e.g. on an error or
connection failure), with a configurable buffer size. When full, the
oldest entry is evicted.

* feat: add Flusher interface for deferred sinks

Flusher (Flush(ctx)) lets callers trigger a flush without depending on
the concrete Buffer type, which is handy when the buffer is created in
one place and flushed in another. Buffer implements it.

* refactor: rename buffer.go and buffer_test.go to flightrecorder.go and
flightrecorder_test.go

* refactor: rename Buffer to FlightRecorder

* refactor: make flight recording a Logger flag with auto-flush on error

Rework the flight recorder from a standalone Buffer/Flusher sink into a
Logger capability. Logger.FlightRecorder(size) enables a rolling
in-memory history of below-level entries; the history is flushed to the
sinks automatically when an entry at LevelError or above is logged, or
manually via Logger.Flush.

Enabling flight recording is independent of the Logger level, so it is
order-independent with Leveled(). Derived loggers (With, Named, Leveled)
share the underlying ring and capture their derived fields and names.

Replace the fill-tracking branch in the ring with a monotonic written
counter: the ring is allocated at full length and writes always land at
written%size, so the write path is branchless and drain derives the
entry count and oldest position from written.

* refactor: track ring position and length instead of unbounded counter

Replace the monotonic written counter with bounded pos and length fields,
so neither grows without limit and t... (continued)

61 of 63 new or added lines in 2 files covered. (96.83%)

956 of 995 relevant lines covered (96.08%)

99.66 hits per line

Relevant lines Covered
Build:
Build:
995 RELEVANT LINES 956 COVERED LINES
99.66 HITS PER LINE
Source Files on main
  • Tree
  • List 12
  • Changed 1
  • Source Changed 0
  • Coverage Changed 1
Coverage ∆ File Lines Relevant Covered Missed Hits/Line

Recent builds

Builds Branch Commit Type Ran Committer Via Coverage
a4f439e4... main feat: add FlightRecorder sink for deferred low-level logging (#237) * feat: add Buffer sink for deferred low-level logging Buffer is a Sink that holds entries below a configured level in a fixed-size in-memory ring, forwarding entries at or abov... push 18 Sep 2026 10:43PM UTC web-flow github
96.08
244048fb... main chore: update dependencies for security fixes (#229) push 05 Jun 2026 11:41AM UTC web-flow github
96.03
08c064db... main fix(internal/syncwriter): write diagnostics in a single os.Stderr write (#226) The error handler used the builtin println, which writes to fd 2 unsynchronized with the test stream and emits the message and its trailing newline as two separate sys... push 05 Jun 2026 08:39AM UTC web-flow github
96.03
284c50fc... main fix: render error types as strings in human log sink (#224) `formatValue` checked `reflect.Struct` before checking the `error` interface, so struct-typed errors like `context.DeadlineExceeded` were serialized via `json.Marshal` as `{}` instead of... push 23 Feb 2026 03:31PM UTC web-flow github
96.03
348ac12d... main chore: update to v3 (#223) push 23 Dec 2025 11:36AM UTC web-flow github
96.01
99abaf9e... main fix!: don't panic, only accept typed log Fields (#222) * fix: don't panic, only accept typed log Fields * slogtest errors if we fail to stringify a field value push 23 Dec 2025 10:42AM UTC web-flow github
96.01
40ff1993... main perf: human log sink performance bump via reduction of allocs/total allocated memory (#220) Signed-off-by: Callum Styan <callumstyan@gmail.com> push 20 Nov 2025 10:47PM UTC web-flow github
95.7
9df5e0a6... main fix!: handle `sql/driver.Valuer` types properly in `slogjson` (#219) Currently, if a field like `sql.NullInt32` has `Valid: False`, `sloghuman` will export it's value as `<nil>`, regardless of it's `String`. This is because it checks `(driver.Va... push 03 Jul 2025 07:43AM UTC web-flow github
96.82
0ec81e6e... main feat: add IgnoreErrorFn to slogtest options (#217) Signed-off-by: Spike Curtis <spike@coder.com> push 12 Nov 2024 04:18AM UTC web-flow github
97.04
3e5cea5e... main ci: fix lint, fmt and upload artifacts (#218) * chore(.github): update actions/upload-artifacts push 08 Nov 2024 06:15AM UTC web-flow github
97.01
See All Builds (169)

Badge your Repo: slog

We detected this repo isn’t badged! Grab the embed code to the right, add it to your repo to show off your code coverage, and when the badge is live hit the refresh button to remove this message.

Could not find badge in README.

Embed ▾
README BADGES
x

If you need to use a raster PNG badge, change the '.svg' to '.png' in the link

Markdown

Textile

RDoc

HTML

Rst

Refresh
  • Settings
  • Repo on GitHub
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE TRIAL · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc