servicelogger

package
v1.121.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 9, 2026 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

View Source
const Dev = "dev"

Variables

This section is empty.

Functions

func EmptyLogger

func EmptyLogger() *log.Helper

func InitZapLogger

func InitZapLogger(env string) (log.Logger, error)

func LogAndMaskErr

func LogAndMaskErr(ctx context.Context, in error, logger *log.Helper) error

LogAndMaskErr records an error but masks it with a generic one to avoid leaking sensitive information. The error is reported on the Sentry hub of ctx when the request has one, so it carries the scope of its own request, and on the global hub otherwise.

func ScopedHelper

func ScopedHelper(logger log.Logger, scope string) *log.Helper

ScopedHelper returns a new helper with information about the current component

func SentryBeforeSend added in v1.104.6

func SentryBeforeSend(event *sentry.Event, hint *sentry.EventHint) *sentry.Event

SentryBeforeSend enriches Sentry error events so issues are distinguishable at a glance and group deterministically by failure mode:

  • A structured discriminator extends Sentry's default fingerprint
  • A generic wrapper type on the primary exception is rewritten to the root-cause type
  • Tags expose the root-cause metadata for search

Events without an original error to analyze (messages, transactions) and errors without a structured discriminator are left untouched, preserving Sentry's default grouping. Joined multi-errors (errors.Join) also keep default grouping: bundling independent failures makes any single fingerprint misleading, though their metadata is tagged.

func SentryHub added in v1.121.0

func SentryHub(ctx context.Context) *sentry.Hub

SentryHub returns the Sentry hub of the request in ctx, or the global hub when ctx has none

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL