~/talk

Structured Logging for the Standard Library

Talkat GopherCon UK 2023 · 2023-08-16..08-18· [go, developer-experience]
slides:none on file

Go 1.21 adds a structured logging package slog that aims for easy, flexible, fast logging; it ships with slog.New with TextHandler and a JSON handler, supports levels and grouped attributes, and interoperates with the existing log package. A fast API path uses Adders fast path (typed constructors like slog.String/slog.Int) and copy-by-value Records plus a small inline array so 95% calls use ≤5 attrs avoid heap allocs; benchmarks target zap-like speed and the implementation reaches that goal.

AI-written summary · about

  1. 0:00Intro
  2. 0:44Logging in Go 1.20: The log package
  3. 1:55Structured Logging Packages
  4. 2:20The Problem
  5. 5:24Use Attrs for Speed
  6. 6:26Levels
  7. 9:03Problem: Conflicting Keys
  8. 12:20The Handler Interface
  9. 12:50Handling a Record
  10. 14:17History of Go Structured Logging
  11. 18:05Write Good Benchmarks
  12. 22:44Heap Allocation
  13. 24:52Avoiding Allocation: Variadic Arguments
  14. 27:22Avoiding Allocation: Pooled Buffers
  15. 29:49Avoiding Allocation: Passing Records
  16. 30:33Avoiding Allocation: Record Attributes
  17. 33:24Implementation of Interface Values
  18. 35:53String Values
  19. 41:13On Alternating Keys and Values
  20. 43:25Working with the Community: A Summary
~/search
type to search 6,249 conferences, 138,987 speakers and 185,172 talks
~/help
cmdctrl k
search every conference, speaker and series
/
focus the filter search
h
home
c
conferences
s
speakers
e
series
t
light / dark — the status bar button does the same
?
this help
esc
close this, then clear every filter — or just the search, while you are typing in it

Ignored while you are typing. Pages without a filter rail have no search to focus.