[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"skill:01M7DFPR850MN0KCV4T0P1E8ET":3,"skill-same:01M7DFPR850MN0KCV4T0P1E8ET":106},{"skillNo":4,"name":5,"nameZh":6,"description":7,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":16,"categories":17,"keywords":18,"publishedAt":19,"linkOnly":20,"markdownContent":21,"markdownBody":22,"frontMatter":23,"refName":63,"commitSha":64,"skillDirectory":65,"forksCount":14,"repositoryHtmlUrl":66,"repositoryHomepageUrl":6,"ownerHtmlUrl":67,"ownerBlogUrl":68,"ownerDescription":69,"updatedAt":70,"install":71,"resources":83},"01M7DFPR850MN0KCV4T0P1E8ET","golang-samber-slog",null,"Structured logging extensions for Golang using samber\u002Fslog-**** packages — multi-handler pipelines (slog-multi), log sampling (slog-sampling), attribute formatting (slog-formatter), HTTP middleware (slog-fiber, slog-gin, slog-chi, slog-echo), and backend routing (slog-datadog, slog-sentry, slog-loki, slog-syslog, slog-logstash, slog-graylog...). Apply when using or adopting slog, or when the codebase already imports any github.com\u002Fsamber\u002Fslog-* package.","heynemann\u002Fomp-marketplace","heynemann","https:\u002F\u002Favatars.githubusercontent.com\u002Fu\u002F60965?v=4","01M7DFBD9ZDB2J2QE7R4AR0PES","Bernardo Heynemann","01M7DFBDAM3NXF540P210W3NYT",0,"MIT","https:\u002F\u002Fgithub.com\u002Fheynemann\u002Fomp-marketplace\u002Fblob\u002Fmain\u002Fplugins\u002Fbase\u002Fskills\u002Fgolang-samber-slog\u002FSKILL.md",[],[],"2026-11-15 14:19:17",false,"---\nname: golang-samber-slog\ndescription: \"Structured logging extensions for Golang using samber\u002Fslog-**** packages — multi-handler pipelines (slog-multi), log sampling (slog-sampling), attribute formatting (slog-formatter), HTTP middleware (slog-fiber, slog-gin, slog-chi, slog-echo), and backend routing (slog-datadog, slog-sentry, slog-loki, slog-syslog, slog-logstash, slog-graylog...). Apply when using or adopting slog, or when the codebase already imports any github.com\u002Fsamber\u002Fslog-* package.\"\nuser-invocable: true\nlicense: MIT\ncompatibility: Designed for Claude Code, Codex or similar harness, and for projects using Golang.\nmetadata:\n  author: samber\n  version: \"1.1.2\"\n  openclaw:\n    emoji: \"🪵\"\n    homepage: https:\u002F\u002Fgithub.com\u002Fsamber\u002Fcc-skills-golang\n    requires:\n      bins:\n        - go\n    install: []\n    skill-library-version:\n      slog-multi: \"1.8.0\"\n      slog-sampling: \"1.6.0\"\n      slog-formatter: \"1.3.0\"\n      slog-fiber: \"1.22.1\"\n      slog-gin: \"1.21.0\"\n      slog-chi: \"1.19.0\"\n      slog-echo: \"1.21.0\"\n      slog-http: \"1.12.0\"\n      slog-betterstack: \"1.4.4\"\n      slog-channel: \"1.4.4\"\n      slog-datadog: \"2.10.4\"\n      slog-sentry: \"2.10.3\"\n      slog-loki: \"3.7.2\"\n      slog-syslog: \"2.5.4\"\n      slog-logstash: \"2.6.4\"\n      slog-graylog: \"2.7.5\"\n      slog-fluentd: \"2.5.4\"\n      slog-kafka: \"2.6.5\"\n      slog-logrus: \"2.5.4\"\n      slog-zap: \"2.6.4\"\n      slog-zerolog: \"2.9.2\"\n      slog-slack: \"2.7.5\"\n      slog-telegram: \"2.4.4\"\n      slog-webhook: \"2.8.4\"\n      slog-mattermost: \"2.5.4\"\n      slog-microsoft-teams: \"2.7.4\"\n      slog-nats: \"0.4.5\"\n      slog-otel: \"0.1.0\"\n      slog-parquet: \"2.5.2\"\n      slog-quickwit: \"0.3.4\"\n      slog-rollbar: \"2.7.4\"\n      slog-mock: \"0.1.0\"\nallowed-tools: Read Edit Write Glob Grep Bash(go:*) Bash(golangci-lint:*) Bash(git:*) Agent WebFetch mcp__context7__resolve-library-id mcp__context7__query-docs AskUserQuestion Bash(godig:*) Bash(gopls:*) LSP mcp__gopls__*\npaths:\n  - \"**\u002F*.go\"\n---\n\n**Persona:** You are a Go logging architect. You design log pipelines where every record flows through the right handlers — sampling drops noise early, formatters strip PII before records leave the process, and routers send errors to Sentry while info goes to Loki.\n\n# samber\u002Fslog-\\*\\*\\*\\* — Structured Logging Pipeline for Go\n\n20+ composable `slog.Handler` packages for Go 1.21+. Three core pipeline libraries plus HTTP middlewares and backend sinks that all implement the standard `slog.Handler` interface.\n\n**Official resources:**\n\n- [github.com\u002Fsamber\u002Fslog-multi](https:\u002F\u002Fgithub.com\u002Fsamber\u002Fslog-multi) — handler composition\n- [github.com\u002Fsamber\u002Fslog-sampling](https:\u002F\u002Fgithub.com\u002Fsamber\u002Fslog-sampling) — throughput control\n- [github.com\u002Fsamber\u002Fslog-formatter](https:\u002F\u002Fgithub.com\u002Fsamber\u002Fslog-formatter) — attribute transformation\n\nThis skill is not exhaustive — refer to library documentation and code examples for more information:\n\n- For Go package docs, symbols, versions, importers, and known vulnerabilities, → See `samber\u002Fcc-skills-golang@golang-pkg-go-dev` skill (`godig`), preferred over Context7 for Go package facts.\n- To navigate this library's usage in your own code (definitions, call sites, diagnostics), → See `samber\u002Fcc-skills-golang@golang-gopls` skill (`gopls`).\n- Context7 remains a fallback for docs not indexed on pkg.go.dev.\n\n## The Pipeline Model\n\nEvery samber\u002Fslog pipeline follows a canonical ordering. Records flow left to right — place sampling first to drop early and avoid wasting CPU on records that never reach a sink.\n\n```\nrecord → [Sampling] → [Pipe: trace\u002FPII] → [Router] → [Sinks]\n```\n\nOrder matters: sampling before formatting saves CPU. Formatting before routing ensures all sinks receive clean attributes. Reversing this wastes work on records that get dropped.\n\n## Core Libraries\n\n| Library | Purpose | Key constructors |\n| --- | --- | --- |\n| `slog-multi` | Handler composition | `Fanout`, `Router`, `FirstMatch`, `Failover`, `Pool`, `Pipe` |\n| `slog-sampling` | Throughput control | `UniformSamplingOption`, `ThresholdSamplingOption`, `AbsoluteSamplingOption`, `CustomSamplingOption` |\n| `slog-formatter` | Attribute transforms | `PIIFormatter`, `ErrorFormatter`, `FormatByType[T]`, `FormatByKey`, `FlattenFormatterMiddleware` |\n\n## slog-multi — Handler Composition\n\nSix composition patterns, each for a different routing need:\n\n| Pattern | Behavior | Latency impact |\n| --- | --- | --- |\n| `Fanout(handlers...)` | Broadcast to all handlers sequentially | Sum of all handler latencies |\n| `Router().Add(h, predicate).Handler()` | Route to ALL matching handlers | Sum of matching handlers |\n| `Router().Add(...).FirstMatch().Handler()` | Route to FIRST match only | Single handler latency |\n| `Failover()(handlers...)` | Try sequentially until one succeeds | Primary handler latency (happy path) |\n| `Pool()(handlers...)` | Load-balance: sends each record to ONE handler | Single handler latency |\n| `Pipe(middlewares...).Handler(sink)` | Middleware chain before sink | Middleware overhead + sink |\n\n```go\n\u002F\u002F Route errors to Sentry, all logs to stdout\nlogger := slog.New(\n    slogmulti.Router().\n        Add(sentryHandler, slogmulti.LevelIs(slog.LevelError)).\n        Add(slog.NewJSONHandler(os.Stdout, nil)).\n        Handler(),\n)\n```\n\nBuilt-in predicates: `LevelIs`, `LevelIsNot`, `MessageIs`, `MessageIsNot`, `MessageContains`, `MessageNotContains`, `AttrValueIs`, `AttrKindIs`.\n\nFor full code examples of every pattern, see [Pipeline Patterns](references\u002Fpipeline-patterns.md).\n\n## slog-sampling — Throughput Control\n\n| Strategy | Behavior | Best for |\n| --- | --- | --- |\n| Uniform | Drop fixed % of all records | Dev\u002Fstaging noise reduction |\n| Threshold | Log first N per interval, then sample at rate R | Production — preserves initial visibility |\n| Absolute | Cap at N records per interval globally | Hard cost control |\n| Custom | User function returns sample rate per record | Level-aware or time-aware rules |\n\nSampling MUST be the outermost handler in the pipeline — placing it after formatting wastes CPU on records that get dropped.\n\n```go\n\u002F\u002F Threshold: log first 10 per 5s, then 10% — errors always pass through via Router\nlogger := slog.New(\n    slogmulti.\n        Pipe(slogsampling.ThresholdSamplingOption{\n            Tick: 5 * time.Second, Threshold: 10, Rate: 0.1,\n        }.NewMiddleware()).\n        Handler(innerHandler),\n)\n```\n\nMatchers group similar records for deduplication: `MatchByLevel()`, `MatchByMessage()`, `MatchByLevelAndMessage()` (default), `MatchBySource()`, `MatchByAttribute(groups, key)`.\n\nFor strategy comparison and configuration details, see [Sampling Strategies](references\u002Fsampling-strategies.md).\n\n## slog-formatter — Attribute Transformation\n\nApply as a `Pipe` middleware so all downstream handlers receive clean attributes.\n\n```go\nlogger := slog.New(\n    slogmulti.Pipe(slogformatter.NewFormatterMiddleware(\n        slogformatter.PIIFormatter(\"user\"),          \u002F\u002F mask PII fields\n        slogformatter.ErrorFormatter(\"error\"),       \u002F\u002F structured error info\n        slogformatter.IPAddressFormatter(\"client\"),  \u002F\u002F mask IP addresses\n    )).Handler(slog.NewJSONHandler(os.Stdout, nil)),\n)\n```\n\nKey formatters: `PIIFormatter`, `ErrorFormatter`, `TimeFormatter`, `UnixTimestampFormatter`, `IPAddressFormatter`, `HTTPRequestFormatter`, `HTTPResponseFormatter`. Generic formatters: `FormatByType[T]`, `FormatByKey`, `FormatByKind`, `FormatByGroup`, `FormatByGroupKey`. Flatten nested attributes with `FlattenFormatterMiddleware`.\n\n## HTTP Middlewares\n\nConsistent pattern across frameworks: `router.Use(slogXXX.New(logger))`.\n\nAvailable: `slog-gin`, `slog-echo`, `slog-fiber`, `slog-chi`, `slog-http` (net\u002Fhttp).\n\nAll share a `Config` struct with: `DefaultLevel`, `ClientErrorLevel`, `ServerErrorLevel`, `WithRequestBody`, `WithResponseBody`, `WithUserAgent`, `WithRequestID`, `WithTraceID`, `WithSpanID`, `Filters`.\n\n```go\n\u002F\u002F Gin with filters — skip health checks\nrouter.Use(sloggin.NewWithConfig(logger, sloggin.Config{\n    DefaultLevel:     slog.LevelInfo,\n    ClientErrorLevel: slog.LevelWarn,\n    ServerErrorLevel: slog.LevelError,\n    WithRequestBody:  true,\n    Filters: []sloggin.Filter{\n        sloggin.IgnorePath(\"\u002Fhealth\", \"\u002Fmetrics\"),\n    },\n}))\n```\n\nFor framework-specific setup, see [HTTP Middlewares](references\u002Fhttp-middlewares.md).\n\n## Backend Sinks\n\nAll follow the `Option{}.NewXxxHandler()` constructor pattern.\n\n| Category     | Packages                                                   |\n| ------------ | ---------------------------------------------------------- |\n| Cloud        | `slog-datadog`, `slog-sentry`, `slog-loki`, `slog-graylog` |\n| Messaging    | `slog-kafka`, `slog-fluentd`, `slog-logstash`, `slog-nats` |\n| Notification | `slog-slack`, `slog-telegram`, `slog-webhook`              |\n| Storage      | `slog-parquet`                                             |\n| Bridges      | `slog-zap`, `slog-zerolog`, `slog-logrus`                  |\n\n**Batch handlers require graceful shutdown** — `slog-datadog`, `slog-loki`, `slog-kafka`, and `slog-parquet` buffer records internally. Flush on shutdown (e.g., `handler.Stop(ctx)` for Datadog, `lokiClient.Stop()` for Loki, `writer.Close()` for Kafka) or buffered logs are lost.\n\nFor configuration examples and shutdown patterns, see [Backend Handlers](references\u002Fbackend-handlers.md).\n\n## Common Mistakes\n\n| Mistake | Why it fails | Fix |\n| --- | --- | --- |\n| Sampling after formatting | Wastes CPU formatting records that get dropped | Place sampling as outermost handler |\n| Fanout to many synchronous handlers | Blocks caller — latency is sum of all handlers | Use `Pool()` for concurrent dispatch |\n| Missing shutdown flush on batch handlers | Buffered logs lost on shutdown | `defer handler.Stop(ctx)` (Datadog), `defer lokiClient.Stop()` (Loki), `defer writer.Close()` (Kafka) |\n| Router without default\u002Fcatch-all handler | Unmatched records silently dropped | Add a handler with no predicate as catch-all |\n| `AttrFromContext` without HTTP middleware | Context has no request attributes to extract | Install `slog-gin`\u002F`echo`\u002F`fiber`\u002F`chi` middleware first |\n| Using `Pipe` with no middleware | No-op wrapper adding per-record overhead | Remove `Pipe()` if no middleware needed |\n\n## Performance Warnings\n\n- **Fanout latency** = sum of all handler latencies (sequential). With 5 handlers at 10ms each, every log call costs 50ms. Use `Pool()` to reduce to max(latencies)\n- **Pipe middleware** adds per-record function call overhead — keep chains short (2-4 middlewares)\n- **slog-formatter** processes attributes sequentially — many formatters compound. For hot-path attribute formatting, prefer implementing `slog.LogValuer` on your types instead\n- **Benchmark** your pipeline with `go test -bench` before production deployment\n\n**Diagnose:** measure per-record allocation and latency of your pipeline and identify which handler in the chain allocates most.\n\n## Best Practices\n\n1. **Sample first, format second, route last** — this canonical ordering minimizes wasted work and ensures all sinks see clean data\n2. **Use Pipe for cross-cutting concerns** — trace ID injection and PII scrubbing belong in middleware, not per-handler logic\n3. **Test pipelines with `slogmulti.NewHandleInlineHandler`** — assert on records reaching each stage without real sinks\n4. **Use `AttrFromContext`** to propagate request-scoped attributes from HTTP middleware to all handlers\n5. **Prefer Router over Fanout** when handlers need different record subsets — Router evaluates predicates and skips non-matching handlers\n\n## Cross-References\n\n- → See `samber\u002Fcc-skills-golang@golang-observability` skill for slog fundamentals (levels, context, handler setup, migration)\n- → See `samber\u002Fcc-skills-golang@golang-error-handling` skill for the log-or-return rule\n- → See `samber\u002Fcc-skills-golang@golang-security` skill for PII handling in logs\n- → See `samber\u002Fcc-skills-golang@golang-samber-oops` skill for structured error context with `samber\u002Foops`\n\nIf you encounter a bug or unexpected behavior in any samber\u002Fslog-\\* package, open an issue at the relevant repository (e.g., [slog-multi\u002Fissues](https:\u002F\u002Fgithub.com\u002Fsamber\u002Fslog-multi\u002Fissues), [slog-sampling\u002Fissues](https:\u002F\u002Fgithub.com\u002Fsamber\u002Fslog-sampling\u002Fissues)).\n","**Persona:** You are a Go logging architect. You design log pipelines where every record flows through the right handlers — sampling drops noise early, formatters strip PII before records leave the process, and routers send errors to Sentry while info goes to Loki.\n\n# samber\u002Fslog-\\*\\*\\*\\* — Structured Logging Pipeline for Go\n\n20+ composable `slog.Handler` packages for Go 1.21+. Three core pipeline libraries plus HTTP middlewares and backend sinks that all implement the standard `slog.Handler` interface.\n\n**Official resources:**\n\n- [github.com\u002Fsamber\u002Fslog-multi](https:\u002F\u002Fgithub.com\u002Fsamber\u002Fslog-multi) — handler composition\n- [github.com\u002Fsamber\u002Fslog-sampling](https:\u002F\u002Fgithub.com\u002Fsamber\u002Fslog-sampling) — throughput control\n- [github.com\u002Fsamber\u002Fslog-formatter](https:\u002F\u002Fgithub.com\u002Fsamber\u002Fslog-formatter) — attribute transformation\n\nThis skill is not exhaustive — refer to library documentation and code examples for more information:\n\n- For Go package docs, symbols, versions, importers, and known vulnerabilities, → See `samber\u002Fcc-skills-golang@golang-pkg-go-dev` skill (`godig`), preferred over Context7 for Go package facts.\n- To navigate this library's usage in your own code (definitions, call sites, diagnostics), → See `samber\u002Fcc-skills-golang@golang-gopls` skill (`gopls`).\n- Context7 remains a fallback for docs not indexed on pkg.go.dev.\n\n## The Pipeline Model\n\nEvery samber\u002Fslog pipeline follows a canonical ordering. Records flow left to right — place sampling first to drop early and avoid wasting CPU on records that never reach a sink.\n\n```\nrecord → [Sampling] → [Pipe: trace\u002FPII] → [Router] → [Sinks]\n```\n\nOrder matters: sampling before formatting saves CPU. Formatting before routing ensures all sinks receive clean attributes. Reversing this wastes work on records that get dropped.\n\n## Core Libraries\n\n| Library | Purpose | Key constructors |\n| --- | --- | --- |\n| `slog-multi` | Handler composition | `Fanout`, `Router`, `FirstMatch`, `Failover`, `Pool`, `Pipe` |\n| `slog-sampling` | Throughput control | `UniformSamplingOption`, `ThresholdSamplingOption`, `AbsoluteSamplingOption`, `CustomSamplingOption` |\n| `slog-formatter` | Attribute transforms | `PIIFormatter`, `ErrorFormatter`, `FormatByType[T]`, `FormatByKey`, `FlattenFormatterMiddleware` |\n\n## slog-multi — Handler Composition\n\nSix composition patterns, each for a different routing need:\n\n| Pattern | Behavior | Latency impact |\n| --- | --- | --- |\n| `Fanout(handlers...)` | Broadcast to all handlers sequentially | Sum of all handler latencies |\n| `Router().Add(h, predicate).Handler()` | Route to ALL matching handlers | Sum of matching handlers |\n| `Router().Add(...).FirstMatch().Handler()` | Route to FIRST match only | Single handler latency |\n| `Failover()(handlers...)` | Try sequentially until one succeeds | Primary handler latency (happy path) |\n| `Pool()(handlers...)` | Load-balance: sends each record to ONE handler | Single handler latency |\n| `Pipe(middlewares...).Handler(sink)` | Middleware chain before sink | Middleware overhead + sink |\n\n```go\n\u002F\u002F Route errors to Sentry, all logs to stdout\nlogger := slog.New(\n    slogmulti.Router().\n        Add(sentryHandler, slogmulti.LevelIs(slog.LevelError)).\n        Add(slog.NewJSONHandler(os.Stdout, nil)).\n        Handler(),\n)\n```\n\nBuilt-in predicates: `LevelIs`, `LevelIsNot`, `MessageIs`, `MessageIsNot`, `MessageContains`, `MessageNotContains`, `AttrValueIs`, `AttrKindIs`.\n\nFor full code examples of every pattern, see [Pipeline Patterns](references\u002Fpipeline-patterns.md).\n\n## slog-sampling — Throughput Control\n\n| Strategy | Behavior | Best for |\n| --- | --- | --- |\n| Uniform | Drop fixed % of all records | Dev\u002Fstaging noise reduction |\n| Threshold | Log first N per interval, then sample at rate R | Production — preserves initial visibility |\n| Absolute | Cap at N records per interval globally | Hard cost control |\n| Custom | User function returns sample rate per record | Level-aware or time-aware rules |\n\nSampling MUST be the outermost handler in the pipeline — placing it after formatting wastes CPU on records that get dropped.\n\n```go\n\u002F\u002F Threshold: log first 10 per 5s, then 10% — errors always pass through via Router\nlogger := slog.New(\n    slogmulti.\n        Pipe(slogsampling.ThresholdSamplingOption{\n            Tick: 5 * time.Second, Threshold: 10, Rate: 0.1,\n        }.NewMiddleware()).\n        Handler(innerHandler),\n)\n```\n\nMatchers group similar records for deduplication: `MatchByLevel()`, `MatchByMessage()`, `MatchByLevelAndMessage()` (default), `MatchBySource()`, `MatchByAttribute(groups, key)`.\n\nFor strategy comparison and configuration details, see [Sampling Strategies](references\u002Fsampling-strategies.md).\n\n## slog-formatter — Attribute Transformation\n\nApply as a `Pipe` middleware so all downstream handlers receive clean attributes.\n\n```go\nlogger := slog.New(\n    slogmulti.Pipe(slogformatter.NewFormatterMiddleware(\n        slogformatter.PIIFormatter(\"user\"),          \u002F\u002F mask PII fields\n        slogformatter.ErrorFormatter(\"error\"),       \u002F\u002F structured error info\n        slogformatter.IPAddressFormatter(\"client\"),  \u002F\u002F mask IP addresses\n    )).Handler(slog.NewJSONHandler(os.Stdout, nil)),\n)\n```\n\nKey formatters: `PIIFormatter`, `ErrorFormatter`, `TimeFormatter`, `UnixTimestampFormatter`, `IPAddressFormatter`, `HTTPRequestFormatter`, `HTTPResponseFormatter`. Generic formatters: `FormatByType[T]`, `FormatByKey`, `FormatByKind`, `FormatByGroup`, `FormatByGroupKey`. Flatten nested attributes with `FlattenFormatterMiddleware`.\n\n## HTTP Middlewares\n\nConsistent pattern across frameworks: `router.Use(slogXXX.New(logger))`.\n\nAvailable: `slog-gin`, `slog-echo`, `slog-fiber`, `slog-chi`, `slog-http` (net\u002Fhttp).\n\nAll share a `Config` struct with: `DefaultLevel`, `ClientErrorLevel`, `ServerErrorLevel`, `WithRequestBody`, `WithResponseBody`, `WithUserAgent`, `WithRequestID`, `WithTraceID`, `WithSpanID`, `Filters`.\n\n```go\n\u002F\u002F Gin with filters — skip health checks\nrouter.Use(sloggin.NewWithConfig(logger, sloggin.Config{\n    DefaultLevel:     slog.LevelInfo,\n    ClientErrorLevel: slog.LevelWarn,\n    ServerErrorLevel: slog.LevelError,\n    WithRequestBody:  true,\n    Filters: []sloggin.Filter{\n        sloggin.IgnorePath(\"\u002Fhealth\", \"\u002Fmetrics\"),\n    },\n}))\n```\n\nFor framework-specific setup, see [HTTP Middlewares](references\u002Fhttp-middlewares.md).\n\n## Backend Sinks\n\nAll follow the `Option{}.NewXxxHandler()` constructor pattern.\n\n| Category     | Packages                                                   |\n| ------------ | ---------------------------------------------------------- |\n| Cloud        | `slog-datadog`, `slog-sentry`, `slog-loki`, `slog-graylog` |\n| Messaging    | `slog-kafka`, `slog-fluentd`, `slog-logstash`, `slog-nats` |\n| Notification | `slog-slack`, `slog-telegram`, `slog-webhook`              |\n| Storage      | `slog-parquet`                                             |\n| Bridges      | `slog-zap`, `slog-zerolog`, `slog-logrus`                  |\n\n**Batch handlers require graceful shutdown** — `slog-datadog`, `slog-loki`, `slog-kafka`, and `slog-parquet` buffer records internally. Flush on shutdown (e.g., `handler.Stop(ctx)` for Datadog, `lokiClient.Stop()` for Loki, `writer.Close()` for Kafka) or buffered logs are lost.\n\nFor configuration examples and shutdown patterns, see [Backend Handlers](references\u002Fbackend-handlers.md).\n\n## Common Mistakes\n\n| Mistake | Why it fails | Fix |\n| --- | --- | --- |\n| Sampling after formatting | Wastes CPU formatting records that get dropped | Place sampling as outermost handler |\n| Fanout to many synchronous handlers | Blocks caller — latency is sum of all handlers | Use `Pool()` for concurrent dispatch |\n| Missing shutdown flush on batch handlers | Buffered logs lost on shutdown | `defer handler.Stop(ctx)` (Datadog), `defer lokiClient.Stop()` (Loki), `defer writer.Close()` (Kafka) |\n| Router without default\u002Fcatch-all handler | Unmatched records silently dropped | Add a handler with no predicate as catch-all |\n| `AttrFromContext` without HTTP middleware | Context has no request attributes to extract | Install `slog-gin`\u002F`echo`\u002F`fiber`\u002F`chi` middleware first |\n| Using `Pipe` with no middleware | No-op wrapper adding per-record overhead | Remove `Pipe()` if no middleware needed |\n\n## Performance Warnings\n\n- **Fanout latency** = sum of all handler latencies (sequential). With 5 handlers at 10ms each, every log call costs 50ms. Use `Pool()` to reduce to max(latencies)\n- **Pipe middleware** adds per-record function call overhead — keep chains short (2-4 middlewares)\n- **slog-formatter** processes attributes sequentially — many formatters compound. For hot-path attribute formatting, prefer implementing `slog.LogValuer` on your types instead\n- **Benchmark** your pipeline with `go test -bench` before production deployment\n\n**Diagnose:** measure per-record allocation and latency of your pipeline and identify which handler in the chain allocates most.\n\n## Best Practices\n\n1. **Sample first, format second, route last** — this canonical ordering minimizes wasted work and ensures all sinks see clean data\n2. **Use Pipe for cross-cutting concerns** — trace ID injection and PII scrubbing belong in middleware, not per-handler logic\n3. **Test pipelines with `slogmulti.NewHandleInlineHandler`** — assert on records reaching each stage without real sinks\n4. **Use `AttrFromContext`** to propagate request-scoped attributes from HTTP middleware to all handlers\n5. **Prefer Router over Fanout** when handlers need different record subsets — Router evaluates predicates and skips non-matching handlers\n\n## Cross-References\n\n- → See `samber\u002Fcc-skills-golang@golang-observability` skill for slog fundamentals (levels, context, handler setup, migration)\n- → See `samber\u002Fcc-skills-golang@golang-error-handling` skill for the log-or-return rule\n- → See `samber\u002Fcc-skills-golang@golang-security` skill for PII handling in logs\n- → See `samber\u002Fcc-skills-golang@golang-samber-oops` skill for structured error context with `samber\u002Foops`\n\nIf you encounter a bug or unexpected behavior in any samber\u002Fslog-\\* package, open an issue at the relevant repository (e.g., [slog-multi\u002Fissues](https:\u002F\u002Fgithub.com\u002Fsamber\u002Fslog-multi\u002Fissues), [slog-sampling\u002Fissues](https:\u002F\u002Fgithub.com\u002Fsamber\u002Fslog-sampling\u002Fissues)).\n",{"name":5,"paths":24,"license":15,"metadata":26,"description":7,"allowed-tools":60,"compatibility":61,"user-invocable":62},[25],"**\u002F*.go",{"author":27,"version":28,"openclaw":29},"samber","1.1.2",{"emoji":30,"install":31,"homepage":32,"requires":33,"skill-library-version":36},"🪵",[],"https:\u002F\u002Fgithub.com\u002Fsamber\u002Fcc-skills-golang",{"bins":34},[35],"go",{"slog-chi":37,"slog-gin":38,"slog-zap":39,"slog-echo":38,"slog-http":40,"slog-loki":41,"slog-mock":42,"slog-nats":43,"slog-otel":42,"slog-fiber":44,"slog-kafka":45,"slog-multi":46,"slog-slack":47,"slog-logrus":48,"slog-sentry":49,"slog-syslog":48,"slog-channel":50,"slog-datadog":51,"slog-fluentd":48,"slog-graylog":47,"slog-parquet":52,"slog-rollbar":53,"slog-webhook":54,"slog-zerolog":55,"slog-logstash":39,"slog-quickwit":56,"slog-sampling":57,"slog-telegram":58,"slog-formatter":59,"slog-mattermost":48,"slog-betterstack":50,"slog-microsoft-teams":53},"1.19.0","1.21.0","2.6.4","1.12.0","3.7.2","0.1.0","0.4.5","1.22.1","2.6.5","1.8.0","2.7.5","2.5.4","2.10.3","1.4.4","2.10.4","2.5.2","2.7.4","2.8.4","2.9.2","0.3.4","1.6.0","2.4.4","1.3.0","Read Edit Write Glob Grep Bash(go:*) Bash(golangci-lint:*) Bash(git:*) Agent WebFetch mcp__context7__resolve-library-id mcp__context7__query-docs AskUserQuestion Bash(godig:*) Bash(gopls:*) LSP mcp__gopls__*","Designed for Claude Code, Codex or similar harness, and for projects using Golang.",true,"main","2147d79c9cd764770418b462c29634bcdc710096","plugins\u002Fbase\u002Fskills\u002Fgolang-samber-slog","https:\u002F\u002Fgithub.com\u002Fheynemann\u002Fomp-marketplace","https:\u002F\u002Fgithub.com\u002Fheynemann","http:\u002F\u002Fwww.thumbor.org","CTO @ Flutter Brazil | Former Meta & Coinbase","2026-09-29 21:26:05",{"source":8,"skillName":5,"commands":72,"prompt":82,"zipAvailable":62},[73,76,79],{"tool":74,"command":75},"npx","npx skills add heynemann\u002Fomp-marketplace --skill golang-samber-slog",{"tool":77,"command":78},"bunx","bunx skills add heynemann\u002Fomp-marketplace --skill golang-samber-slog",{"tool":80,"command":81},"pnpm","pnpm dlx skills add heynemann\u002Fomp-marketplace --skill golang-samber-slog","安装技能，技能地址：https:\u002F\u002Fgithub.com\u002Fheynemann\u002Fomp-marketplace\u002Fblob\u002Fmain\u002Fplugins\u002Fbase\u002Fskills\u002Fgolang-samber-slog\u002FSKILL.md",[84,90,94,98,102],{"path":85,"resourceType":86,"resourceTypeDesc":87,"sizeBytes":88,"sourceHtmlUrl":89},"evals\u002Fevals.json","REFERENCE","参考文档",16040,"https:\u002F\u002Fgithub.com\u002Fheynemann\u002Fomp-marketplace\u002Fblob\u002Fmain\u002Fplugins\u002Fbase\u002Fskills\u002Fgolang-samber-slog\u002Fevals\u002Fevals.json",{"path":91,"resourceType":86,"resourceTypeDesc":87,"sizeBytes":92,"sourceHtmlUrl":93},"references\u002Fbackend-handlers.md",8429,"https:\u002F\u002Fgithub.com\u002Fheynemann\u002Fomp-marketplace\u002Fblob\u002Fmain\u002Fplugins\u002Fbase\u002Fskills\u002Fgolang-samber-slog\u002Freferences\u002Fbackend-handlers.md",{"path":95,"resourceType":86,"resourceTypeDesc":87,"sizeBytes":96,"sourceHtmlUrl":97},"references\u002Fhttp-middlewares.md",5635,"https:\u002F\u002Fgithub.com\u002Fheynemann\u002Fomp-marketplace\u002Fblob\u002Fmain\u002Fplugins\u002Fbase\u002Fskills\u002Fgolang-samber-slog\u002Freferences\u002Fhttp-middlewares.md",{"path":99,"resourceType":86,"resourceTypeDesc":87,"sizeBytes":100,"sourceHtmlUrl":101},"references\u002Fpipeline-patterns.md",8975,"https:\u002F\u002Fgithub.com\u002Fheynemann\u002Fomp-marketplace\u002Fblob\u002Fmain\u002Fplugins\u002Fbase\u002Fskills\u002Fgolang-samber-slog\u002Freferences\u002Fpipeline-patterns.md",{"path":103,"resourceType":86,"resourceTypeDesc":87,"sizeBytes":104,"sourceHtmlUrl":105},"references\u002Fsampling-strategies.md",7125,"https:\u002F\u002Fgithub.com\u002Fheynemann\u002Fomp-marketplace\u002Fblob\u002Fmain\u002Fplugins\u002Fbase\u002Fskills\u002Fgolang-samber-slog\u002Freferences\u002Fsampling-strategies.md",[107,114,121,128,135,142],{"skillNo":108,"name":109,"nameZh":6,"description":110,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":111,"categories":112,"keywords":113,"publishedAt":19},"01M7DFXDYP0N6P8KR0AF7C0TDK","writing-for-agents","Writing documents for agents. Use when creating or editing skills, or modifying AGENTS.md or CLAUDE.md.","https:\u002F\u002Fgithub.com\u002Fheynemann\u002Fomp-marketplace\u002Fblob\u002Fmain\u002Fplugins\u002Fbase\u002Fskills\u002Fwriting-for-agents\u002FSKILL.md",[],[],{"skillNo":115,"name":116,"nameZh":6,"description":117,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":118,"categories":119,"keywords":120,"publishedAt":19},"01M7DFX9C5B0T1T0AVDCWNR5P2","write-skill","Use when creating, designing, or fixing an agent skill (SKILL.md pack) — triggers include \"write a skill\", \"make me a skill\", \"create a skill\", skill directories, and skills that fail to trigger or fire on the wrong tasks.","https:\u002F\u002Fgithub.com\u002Fheynemann\u002Fomp-marketplace\u002Fblob\u002Fmain\u002Fplugins\u002Fbase\u002Fskills\u002Fwrite-skill\u002FSKILL.md",[],[],{"skillNo":122,"name":123,"nameZh":6,"description":124,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":125,"categories":126,"keywords":127,"publishedAt":19},"01M7DFX64VSTQV0CSGYR76MPZF","write-agent","Use when creating, designing, or fixing an omp subagent (task agent) — triggers include \"write an agent\", \"make me an agent\", \"create a subagent\", agent `.md` definitions, and agents that misbehave when spawned via task.","https:\u002F\u002Fgithub.com\u002Fheynemann\u002Fomp-marketplace\u002Fblob\u002Fmain\u002Fplugins\u002Fbase\u002Fskills\u002Fwrite-agent\u002FSKILL.md",[],[],{"skillNo":129,"name":130,"nameZh":6,"description":131,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":132,"categories":133,"keywords":134,"publishedAt":19},"01M7DFX22JEY7ZN9EDESM732K5","wizard","Generate an interactive bash wizard that walks a human through steps only they can perform. Use when provisioning infrastructure, setting up credentials or CI secrets, walking an unfamiliar third-party dashboard, or running a one-off migration or cutover. Don't invoke this for steps the agent can perform itself.","https:\u002F\u002Fgithub.com\u002Fheynemann\u002Fomp-marketplace\u002Fblob\u002Fmain\u002Fplugins\u002Fbase\u002Fskills\u002Fwizard\u002FSKILL.md",[],[],{"skillNo":136,"name":137,"nameZh":6,"description":138,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":139,"categories":140,"keywords":141,"publishedAt":19},"01M7DFWYXR5V2CY2BPDAAS19R1","wayfinder","Plan a huge chunk of work (more than one agent session can hold) as a shared map of decision tickets on your issue tracker, and resolve them one at a time until the way to the destination is clear.","https:\u002F\u002Fgithub.com\u002Fheynemann\u002Fomp-marketplace\u002Fblob\u002Fmain\u002Fplugins\u002Fbase\u002Fskills\u002Fwayfinder\u002FSKILL.md",[],[],{"skillNo":143,"name":144,"nameZh":6,"description":145,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":146,"categories":147,"keywords":148,"publishedAt":19},"01M7DFWXFFMBKV294WS66S475V","wait-what","Stop. That last message did not land: re-pitch it.","https:\u002F\u002Fgithub.com\u002Fheynemann\u002Fomp-marketplace\u002Fblob\u002Fmain\u002Fplugins\u002Fbase\u002Fskills\u002Fwait-what\u002FSKILL.md",[],[]]