Go Wiki: slogのリソース
このページでは、標準ライブラリの構造化ロギングパッケージであるslogを使用または拡張するプロジェクトへのリンクを掲載しています。
ログのフォーマット
- slog-formatter: slog用の一般的なフォーマッターと、独自のフォーマッターを構築するためのヘルパー: https://github.com/samber/slog-formatter
- ConsoleHandler (ZapのConsoleEncoderに類似): https://gist.github.com/wijayaerick/de3de10c47a79d5310968ba5ff101a19
- logf (属性 {キー} 補間、リッチなTTY出力): https://pkg.go.dev/github.com/AndrewHarrisSPU/logf (遅延Handlerストアを使用: https://go.dokyumento.jp/play/p/psdD7KDF5fp)
- slogd - 期間付きのslog https://github.com/kaihendry/slogd ビデオ付き https://youtu.be/IsPa11N5pzI
- tinted (色付き) 出力: https://pkg.go.dev/github.com/lmittmann/tint
- humane: 人間に優しい(しかし大部分は構造化された)slogハンドラー: https://github.com/telemachus/humane
- slug: 人間向けのカラフルなログを出力するハンドラー: https://github.com/dotse/slug
- slogor: カラフルなslogハンドラー: https://gitlab.com/greyxor/slogor
- klog: Kubernetesが使用するテキスト形式。メインパッケージのロガーを使用する際のklog出力ルーティングと、stderrに書き込むだけのよりシンプルなロガーを提供します。slog/logrとgo-logr/logrの両方のAPIがサポートされています。
- slogjson: 近日公開予定のJSON v2ライブラリを使用してフォーマットし、オプションで単一行の整形出力も可能: https://github.com/veqryn/slog-json
ロガーブリッジ
- Zap Handler, Zapを使用するslogハンドラー: https://github.com/chanchal1987/zaphandler
- zapr: v1.3.0以降、同じロガーインスタンスでslog/logrとgo-logr/logrの両方のAPIがサポートされます。
- GoKit用のハンドラー: https://github.com/tjhop/slog-gokit
ロギングミドルウェア
- slogctx: コンテキストに属性またはロガーを格納し、コンテキストからカスタム値を読み込む: https://github.com/veqryn/slog-context
- slog-context/otel: OpenTelemetry TraceIDとSpanIDを自動的に読み込んでログに追加し、Spanのエラーコードを設定できる: github.com/veqryn/slog-context/otel
- slogdedup: 複数のポリシーによる属性キーの重複排除とソート。JSONロギングに役立ちます。Stackdriver、Graylogなどへの出力のための便利なメソッド: https://github.com/veqryn/slog-dedup
HTTPサーバーミドルウェア
- slog-gin: slogロガー用のGinミドルウェア: https://github.com/samber/slog-gin
- slog-echo: slogロガー用のEchoミドルウェア: https://github.com/samber/slog-echo
- slog-fiber: slogロガー用のFiberミドルウェア: https://github.com/samber/slog-fiber
- slog-chi: slogロガー用のChiミドルウェア: https://github.com/samber/slog-chi
ログシンク
- OpenTelemetryと
slogの両方を使用した実験的な例: https://github.com/justinsb/experiments-slog - OpenTelemetryトレーシングを備えたシンプルなslogハンドラー: https://github.com/ttys3/slogsimple/tree/main
- slog-datadog: Datadog用の
slog.Handler: https://github.com/samber/slog-datadog - slog-rollbar: Rollbar用の
slog.Handler: https://github.com/samber/slog-rollbar - slog-sentry: Sentry用の
slog.Handler: https://github.com/samber/slog-sentry - slog-syslog: Syslog用の
slog.Handler: https://github.com/samber/slog-syslog - slog-logstash: Logstash用の
slog.Handler: https://github.com/samber/slog-logstash - slog-fluentd: Fluentd用の
slog.Handler: https://github.com/samber/slog-fluentd - slog-graylog: Graylog用の
slog.Handler: https://github.com/samber/slog-graylog - slog-loki: Loki用の
slog.Handler: https://github.com/samber/slog-loki - slog-slack: Slack用の
slog.Handler: https://github.com/samber/slog-slack - slog-telegram: Telegram用の
slog.Handler: https://github.com/samber/slog-telegram - slog-mattermost: Mattermost用の
slog.Handler: https://github.com/samber/slog-mattermost - slog-microsoft-teams: Microsoft Teams用の
slog.Handler: https://github.com/samber/slog-microsoft-teams - slog-webhook: Webhook用の
slog.Handler: https://github.com/samber/slog-webhook - slog-kafka: Kafka用の
slog.Handler: https://github.com/samber/slog-kafka - slogbugsnag: Bugsnag用の
slog.Handler: https://github.com/veqryn/slog-bugsnag - slogdriver: Stackdriver Logging / GCP Cloud Logging用の
slog.Handler: https://github.com/jussi-kalliokoski/slogdriver
ハンドラー
- slog-multi:
slog.Handlerのチェーン (パイプライン、ファンアウトなど): https://github.com/samber/slog-multi - 様々なハンドラー: https://github.com/galecore/xslog
その他
- jbaによって書かれた追加リソース: https://github.com/jba/slog
- slog-sampling: 繰り返されるログエントリを削除する: https://github.com/samber/slog-sampling
- slog-context: コンテキストから値を読み取るサポートを追加: https://github.com/PumpkinSeed/slog-context
- slogassert: コードから発行されたslogログをテストするためのハンドラー: https://github.com/thejerf/slogassert
- sloggen:
log/slog用の様々なヘルパーを生成する: https://github.com/go-simpler/sloggen - sloglint:
log/slogを使用する際に一貫したコードスタイルを確保する: https://github.com/go-simpler/sloglint
このコンテンツはGo Wikiの一部です。