log

package
v0.0.0-...-8cfd559 Latest Latest
Warning

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

Go to latest
Published: May 2, 2024 License: Apache-2.0 Imports: 10 Imported by: 3

Documentation

Index

Constants

View Source
const DefaultLevel = LevelWarn
View Source
const KeySkipLogging = "__authgear_skip_logging"

Variables

View Source
var Null = logrus.NewEntry(&logrus.Logger{Out: ioutil.Discard, Formatter: nullFormatter{}})

Functions

func IsLoggingSkipped

func IsLoggingSkipped(e *logrus.Entry) bool

func NewDefaultMaskLogHook

func NewDefaultMaskLogHook() logrus.Hook

func SkipLogging

func SkipLogging(e *logrus.Entry)

Types

type Factory

type Factory struct {
	Level         Level
	DefaultFields logrus.Fields
	Hooks         []logrus.Hook
	Logger        *Logger
}

func NewFactory

func NewFactory(level Level, hooks ...logrus.Hook) *Factory

func (*Factory) New

func (f *Factory) New(name string) *Logger

func (*Factory) ReplaceHooks

func (f *Factory) ReplaceHooks(hooks ...logrus.Hook) *Factory

type FormatHook

type FormatHook struct {
	MaskPatterns []MaskPattern
	Mask         string
}

func (*FormatHook) Fire

func (h *FormatHook) Fire(entry *logrus.Entry) error

func (*FormatHook) Levels

func (h *FormatHook) Levels() []logrus.Level

type Level

type Level string
const (
	LevelDebug Level = "debug"
	LevelInfo  Level = "info"
	LevelWarn  Level = "warn"
	LevelError Level = "error"
)

func ParseLevel

func ParseLevel(s string) (Level, error)

func (Level) Logrus

func (l Level) Logrus() logrus.Level

type Logger

type Logger = logrus.Entry

type MaskPattern

type MaskPattern interface {
	Mask(s string, mask string) string
}

type PlainMaskPattern

type PlainMaskPattern struct {
	Pattern string
}

func NewPlainMaskPattern

func NewPlainMaskPattern(s string) PlainMaskPattern

func (PlainMaskPattern) Mask

func (p PlainMaskPattern) Mask(s string, mask string) string

type RegexMaskPattern

type RegexMaskPattern struct {
	Pattern *regexp.Regexp
}

func NewRegexMaskPattern

func NewRegexMaskPattern(expr string) RegexMaskPattern

func (RegexMaskPattern) Mask

func (p RegexMaskPattern) Mask(s string, mask string) string

type StackHook

type StackHook struct{}

StackHook attaches call stack to entries with level >= error.

func (*StackHook) Fire

func (h *StackHook) Fire(entry *logrus.Entry) error

func (*StackHook) Levels

func (h *StackHook) Levels() []logrus.Level

type WriterHook

type WriterHook struct {
	Writer    io.Writer
	Formatter logrus.Formatter
}

WriterHook replaces logger.Out. Since logger.Out works with logger.Formatter, We have to replicate the behavior here. The reason for WriterHook to exist is to call our Ignore() to filter out unwanted entry.

func NewWriterHook

func NewWriterHook(w io.Writer) *WriterHook

func (*WriterHook) Fire

func (h *WriterHook) Fire(entry *logrus.Entry) error

func (*WriterHook) Levels

func (h *WriterHook) Levels() []logrus.Level

Jump to

Keyboard shortcuts

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