log

package
v0.0.0-...-4705fdb Latest Latest
Warning

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

Go to latest
Published: Dec 20, 2021 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Close

func Close()

func Hub

func Hub(hub *sentry.Hub) zapcore.Field

Hub attaches a Sentry hub to the logger such that if the logger ever logs an error, request context can be sent to Sentry.

func Open

func Open(filename string, level zapcore.Level, maxSize, maxBackups, maxAge int, compress bool)

Types

type SentryCore

type SentryCore struct {
	zapcore.LevelEnabler
	// contains filtered or unexported fields
}

Core Implements a zapcore.Core that sends logged errors to Sentry

func (*SentryCore) Check

func (s *SentryCore) Check(entry zapcore.Entry, check *zapcore.CheckedEntry) *zapcore.CheckedEntry

Check determines whether the supplied Entry should be logged (using the embedded LevelEnabler and possibly some extra logic). If the entry should be logged, the Core adds itself to the CheckedEntry and returns the result.

Write logs the entry and fields supplied at the log site and writes them to their destination. If a Sentry Hub field is present in the fields, that Hub will be used for reporting to Sentry, otherrwise the default Sentry Hub will be used.

Callers must use Check before calling Write.

func (*SentryCore) Sync

func (s *SentryCore) Sync() error

Sync flushes buffered logs (if any).

func (*SentryCore) With

func (s *SentryCore) With(fields []zap.Field) zapcore.Core

With adds structured context to the Core.

func (*SentryCore) Write

func (s *SentryCore) Write(entry zapcore.Entry, fields []zap.Field) error

Write serializes the Entry and any Fields supplied at the log site and writes them to their destination.

If called, Write should always log the Entry and Fields; it should not replicate the logic of Check.

Jump to

Keyboard shortcuts

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