[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"skill:01M759411K7PM3DSQYNBVN7MBT":3,"skill-same:01M759411K7PM3DSQYNBVN7MBT":104},{"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":61,"commitSha":62,"skillDirectory":63,"forksCount":64,"repositoryHtmlUrl":65,"repositoryHomepageUrl":6,"ownerHtmlUrl":66,"ownerBlogUrl":6,"ownerDescription":67,"updatedAt":68,"install":69,"resources":81},"01M759411K7PM3DSQYNBVN7MBT","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.","davidcoachdev\u002Fdcfiles","davidcoachdev","https:\u002F\u002Favatars.githubusercontent.com\u002Fu\u002F69812733?v=4","01M758C4BR16TAV1N47W319E9V","David H. Caycedo Blum.","01M758C4CCZA2ZYGA0BGMXCDRH",1,"MIT","https:\u002F\u002Fgithub.com\u002Fdavidcoachdev\u002Fdcfiles\u002Fblob\u002Fmain\u002Fconfig\u002F.config\u002Fopencode\u002Fskills\u002Fgolang-samber-slog\u002FSKILL.md",[],[],"2026-11-12 13:55:43",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 OpenCode or similar AI coding agents, and for projects using Golang.\nmetadata:\n  author: gentleman-programming\n  version: \"1.0.7\"\n  openclaw:\n    emoji: \"🪵\"\n    homepage: https:\u002F\u002Fgithub.com\u002Fgentleman-programming\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__*\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. Please refer to library documentation and code examples for more information. For Go package docs, symbols, versions, importers, and known vulnerabilities, → See `golang-pkg-go-dev` skill (`godig`) — prefer it over Context7 for Go package facts. To navigate this library's usage in your own code (definitions, call sites, diagnostics), → See `golang-gopls` skill (`gopls`). 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 `golang-observability` skill for slog fundamentals (levels, context, handler setup, migration)\n- → See `golang-error-handling` skill for the log-or-return rule\n- → See `golang-security` skill for PII handling in logs\n- → See `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. Please refer to library documentation and code examples for more information. For Go package docs, symbols, versions, importers, and known vulnerabilities, → See `golang-pkg-go-dev` skill (`godig`) — prefer it over Context7 for Go package facts. To navigate this library's usage in your own code (definitions, call sites, diagnostics), → See `golang-gopls` skill (`gopls`). 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 `golang-observability` skill for slog fundamentals (levels, context, handler setup, migration)\n- → See `golang-error-handling` skill for the log-or-return rule\n- → See `golang-security` skill for PII handling in logs\n- → See `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,"license":15,"metadata":24,"description":7,"allowed-tools":58,"compatibility":59,"user-invocable":60},{"author":25,"version":26,"openclaw":27},"gentleman-programming","1.0.7",{"emoji":28,"install":29,"homepage":30,"requires":31,"skill-library-version":34},"🪵",[],"https:\u002F\u002Fgithub.com\u002Fgentleman-programming",{"bins":32},[33],"go",{"slog-chi":35,"slog-gin":36,"slog-zap":37,"slog-echo":36,"slog-http":38,"slog-loki":39,"slog-mock":40,"slog-nats":41,"slog-otel":40,"slog-fiber":42,"slog-kafka":43,"slog-multi":44,"slog-slack":45,"slog-logrus":46,"slog-sentry":47,"slog-syslog":46,"slog-channel":48,"slog-datadog":49,"slog-fluentd":46,"slog-graylog":45,"slog-parquet":50,"slog-rollbar":51,"slog-webhook":52,"slog-zerolog":53,"slog-logstash":37,"slog-quickwit":54,"slog-sampling":55,"slog-telegram":56,"slog-formatter":57,"slog-mattermost":46,"slog-betterstack":48,"slog-microsoft-teams":51},"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 OpenCode or similar AI coding agents, and for projects using Golang.",true,"main","5dc86f90a5cbe45db3acd917825461b3ed6937fb","config\u002F.config\u002Fopencode\u002Fskills\u002Fgolang-samber-slog",0,"https:\u002F\u002Fgithub.com\u002Fdavidcoachdev\u002Fdcfiles","https:\u002F\u002Fgithub.com\u002Fdavidcoachdev","🌐 Apasionado por crear soluciones web escalables y eficientes. \r\n🧑‍🏫 Coach Dev.\r\n💻 Frontend Dev. \r\n🎚️Backend Dev.\r\n📊 Agile\u002FScrum.\r\n🚀100% remoto.","2026-08-26 07:28:05",{"source":8,"skillName":5,"commands":70,"prompt":80,"zipAvailable":60},[71,74,77],{"tool":72,"command":73},"npx","npx skills add davidcoachdev\u002Fdcfiles --skill golang-samber-slog",{"tool":75,"command":76},"bunx","bunx skills add davidcoachdev\u002Fdcfiles --skill golang-samber-slog",{"tool":78,"command":79},"pnpm","pnpm dlx skills add davidcoachdev\u002Fdcfiles --skill golang-samber-slog","安装技能，技能地址：https:\u002F\u002Fgithub.com\u002Fdavidcoachdev\u002Fdcfiles\u002Fblob\u002Fmain\u002Fconfig\u002F.config\u002Fopencode\u002Fskills\u002Fgolang-samber-slog\u002FSKILL.md",[82,88,92,96,100],{"path":83,"resourceType":84,"resourceTypeDesc":85,"sizeBytes":86,"sourceHtmlUrl":87},"evals\u002Fevals.json","REFERENCE","参考文档",16040,"https:\u002F\u002Fgithub.com\u002Fdavidcoachdev\u002Fdcfiles\u002Fblob\u002Fmain\u002Fconfig\u002F.config\u002Fopencode\u002Fskills\u002Fgolang-samber-slog\u002Fevals\u002Fevals.json",{"path":89,"resourceType":84,"resourceTypeDesc":85,"sizeBytes":90,"sourceHtmlUrl":91},"references\u002Fbackend-handlers.md",7406,"https:\u002F\u002Fgithub.com\u002Fdavidcoachdev\u002Fdcfiles\u002Fblob\u002Fmain\u002Fconfig\u002F.config\u002Fopencode\u002Fskills\u002Fgolang-samber-slog\u002Freferences\u002Fbackend-handlers.md",{"path":93,"resourceType":84,"resourceTypeDesc":85,"sizeBytes":94,"sourceHtmlUrl":95},"references\u002Fhttp-middlewares.md",5242,"https:\u002F\u002Fgithub.com\u002Fdavidcoachdev\u002Fdcfiles\u002Fblob\u002Fmain\u002Fconfig\u002F.config\u002Fopencode\u002Fskills\u002Fgolang-samber-slog\u002Freferences\u002Fhttp-middlewares.md",{"path":97,"resourceType":84,"resourceTypeDesc":85,"sizeBytes":98,"sourceHtmlUrl":99},"references\u002Fpipeline-patterns.md",8333,"https:\u002F\u002Fgithub.com\u002Fdavidcoachdev\u002Fdcfiles\u002Fblob\u002Fmain\u002Fconfig\u002F.config\u002Fopencode\u002Fskills\u002Fgolang-samber-slog\u002Freferences\u002Fpipeline-patterns.md",{"path":101,"resourceType":84,"resourceTypeDesc":85,"sizeBytes":102,"sourceHtmlUrl":103},"references\u002Fsampling-strategies.md",6604,"https:\u002F\u002Fgithub.com\u002Fdavidcoachdev\u002Fdcfiles\u002Fblob\u002Fmain\u002Fconfig\u002F.config\u002Fopencode\u002Fskills\u002Fgolang-samber-slog\u002Freferences\u002Fsampling-strategies.md",[105,113,120,127,134,141],{"skillNo":106,"name":107,"nameZh":6,"description":108,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":109,"licenseFileUrl":6,"sourceHtmlUrl":110,"categories":111,"keywords":112,"publishedAt":19},"01M7740FETMZY1VTYAEFY1TWY7","zustand-5","Zustand 5 state management patterns. Trigger: When managing React state with Zustand.","Apache-2.0","https:\u002F\u002Fgithub.com\u002Fdavidcoachdev\u002Fdcfiles\u002Fblob\u002Fmain\u002Fconfig\u002F.config\u002Fopencode\u002Fskills\u002Fzustand-5\u002FSKILL.md",[],[],{"skillNo":114,"name":115,"nameZh":6,"description":116,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":109,"licenseFileUrl":6,"sourceHtmlUrl":117,"categories":118,"keywords":119,"publishedAt":19},"01M773ZZM9V68SA1AKP4WF4J29","zod-4","Zod 4 schema validation patterns. Trigger: When using Zod for validation - breaking changes from v3.","https:\u002F\u002Fgithub.com\u002Fdavidcoachdev\u002Fdcfiles\u002Fblob\u002Fmain\u002Fconfig\u002F.config\u002Fopencode\u002Fskills\u002Fzod-4\u002FSKILL.md",[],[],{"skillNo":121,"name":122,"nameZh":6,"description":123,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":109,"licenseFileUrl":6,"sourceHtmlUrl":124,"categories":125,"keywords":126,"publishedAt":19},"01M773ZJFR90CQAY0N9QR40QVP","x-bookmark-quote-posts","Workflow para revisar bookmarks de X\u002FTwitter y convertirlos en drafts de quote posts. Accede a la sección de bookmarks vía browser headless, extrae posts recientes, y genera drafts con voz personal del usuario. No publica ni muta X — solo genera contenido para revisión. Trigger: X bookmarks, Twitter bookmarks, quote posts, bookmark automation, crear quote posts, revisar bookmarks, growth content X.","https:\u002F\u002Fgithub.com\u002Fdavidcoachdev\u002Fdcfiles\u002Fblob\u002Fmain\u002Fconfig\u002F.config\u002Fopencode\u002Fskills\u002Fx-bookmark-quote-posts\u002FSKILL.md",[],[],{"skillNo":128,"name":129,"nameZh":6,"description":130,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":131,"categories":132,"keywords":133,"publishedAt":19},"01M773Z2RGV3786FV310SDB0YD","writing-skills","Use when creating new skills, editing existing skills, or verifying skills work before deployment","https:\u002F\u002Fgithub.com\u002Fdavidcoachdev\u002Fdcfiles\u002Fblob\u002Fmain\u002Fconfig\u002F.config\u002Fopencode\u002Fskills\u002Fwriting-skills\u002FSKILL.md",[],[],{"skillNo":135,"name":136,"nameZh":6,"description":137,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":138,"categories":139,"keywords":140,"publishedAt":19},"01M773YJH3KDSW467CSS63CSRJ","writing-plans","Use when you have a spec or requirements for a multi-step task, before touching code","https:\u002F\u002Fgithub.com\u002Fdavidcoachdev\u002Fdcfiles\u002Fblob\u002Fmain\u002Fconfig\u002F.config\u002Fopencode\u002Fskills\u002Fwriting-plans\u002FSKILL.md",[],[],{"skillNo":142,"name":143,"nameZh":6,"description":144,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":109,"licenseFileUrl":6,"sourceHtmlUrl":145,"categories":146,"keywords":147,"publishedAt":19},"01M773Y3S3H2CPRK5S8YFHWB5C","work-unit-commits","Plan commits as reviewable work units. Trigger: implementation, commit splitting, chained PRs, or keeping tests and docs with code.","https:\u002F\u002Fgithub.com\u002Fdavidcoachdev\u002Fdcfiles\u002Fblob\u002Fmain\u002Fconfig\u002F.config\u002Fopencode\u002Fskills\u002Fwork-unit-commits\u002FSKILL.md",[],[]]