Go Wiki: slogに関するリソース
このページは、標準ライブラリの構造化ログパッケージであるslog
を使用または拡張するプロジェクトへのリンクを示しています。
ログフォーマット
- slog-formatter: slog用の一般的なフォーマッタと独自のフォーマッタ構築のためのヘルパー: https://github.com/samber/slog-formatter
- ConsoleHandler (ZapのConsoleEncoderに似ています): https://gist.github.com/wijayaerick/de3de10c47a79d5310968ba5ff101a19
- logf (attr {key}補間、リッチなTTY出力): https://pkg.go.dev/github.com/AndrewHarrisSPU/logf (レイジーハンドラストアを使用: https://go.dokyumento.jp/play/p/psdD7KDF5fp )
- slogd - 継続時間付きslog https://github.com/kaihendry/slogd ビデオ付き https://youtu.be/IsPa11N5pzI
- 色付き(カラー化された)出力: 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ライブラリを使用したフォーマットで、オプションで1行の整形済み印刷も可能です: 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が同じロガーインスタンスでサポートされています。
ロギングミドルウェア
- 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の一部です。