Documentation ¶
Index ¶
- Constants
- Variables
- func Debug(msg string, args ...any)
- func DebugContext(ctx context.Context, msg string, args ...any)
- func Error(msg string, args ...any)
- func ErrorContext(ctx context.Context, msg string, args ...any)
- func Info(msg string, args ...any)
- func InfoContext(ctx context.Context, msg string, args ...any)
- func LoggingHandlersToInf() []interface{}
- func NewAsyncHandler(h slog.Handler) slog.Handler
- func NewJSONHandler(opts ...Option) slog.Handler
- func NewTextHandler(opts ...Option) slog.Handler
- func Warn(msg string, args ...any)
- func WarnContext(ctx context.Context, msg string, args ...any)
- func WithStack(err error) slog.Attr
- type AsyncHandler
- type ErrorTracking
- type Handle
- type LoggingHandle
- type Option
- type ReplaceAttr
- type RollbarConfig
- type SentryConfig
- type Service
Constants ¶
View Source
const ( JsonHandler = LoggingHandle("json") TextHandler = LoggingHandle("text") SentryHandler = LoggingHandle("sentry") RollbarHandler = LoggingHandle("rollbar") DatadogHandler = LoggingHandle("datadog") )
Variables ¶
View Source
var (
LoggingHandlers = []LoggingHandle{JsonHandler, TextHandler, SentryHandler, RollbarHandler, DatadogHandler}
)
View Source
var StdLogger = log.New(&writer{}, "goff", log.LstdFlags)
Functions ¶
func LoggingHandlersToInf ¶
func LoggingHandlersToInf() []interface{}
func NewJSONHandler ¶
func NewTextHandler ¶
Types ¶
type AsyncHandler ¶
func (*AsyncHandler) Close ¶
func (h *AsyncHandler) Close() error
type ErrorTracking ¶
func (*ErrorTracking) Close ¶
func (h *ErrorTracking) Close() error
type Handle ¶
func NewErrorTracking ¶
func NewHandler ¶
func NewRollbarHandler ¶
func NewRollbarHandler(conf *RollbarConfig) Handle
func NewSentryHandler ¶
func NewSentryHandler(conf *SentryConfig, environment string) Handle
type LoggingHandle ¶
type LoggingHandle string
func (LoggingHandle) String ¶
func (h LoggingHandle) String() string
type Option ¶
type Option interface {
// contains filtered or unexported methods
}
func WithHandler ¶
func WithReplaceAttr ¶
func WithReplaceAttr(attrFn ReplaceAttr) Option
func WithWriter ¶
type RollbarConfig ¶
type RollbarConfig struct { Level string `yaml:"level" default:"warn"` Token string `yaml:"token"` Env string `yaml:"env"` Client *http.Client // contains filtered or unexported fields }
func (*RollbarConfig) Close ¶
func (c *RollbarConfig) Close()
func (*RollbarConfig) Init ¶
func (c *RollbarConfig) Init(env, version, serverRoot string)
func (RollbarConfig) Validate ¶
func (c RollbarConfig) Validate() error
type SentryConfig ¶
type SentryConfig struct { Level string `yaml:"level" default:"warn"` DSN string `yaml:"dsn"` SampleRate float64 `yaml:"sampleRate" default:"1.0"` IgnoreErrors []string `yaml:"ignoreErrors"` SendDefaultPII bool `yaml:"sendDefaultPII"` Env string `yaml:"env"` Transport sentry.Transport `yaml:"-"` }
func (*SentryConfig) SentryOptions ¶
func (c *SentryConfig) SentryOptions(environment string) sentry.ClientOptions
func (SentryConfig) Validate ¶
func (c SentryConfig) Validate() error
Click to show internal directories.
Click to hide internal directories.