logger

package
v0.0.0-...-f47fe49 Latest Latest
Warning

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

Go to latest
Published: Apr 24, 2024 License: Apache-2.0 Imports: 21 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var GetCloudWatchHook func(config *appconf.SourcesApiConfig) *lc.Hook

GetCloudWatchHook is an overrideable function which returns a CloudWatch Hook. The idea is to abstract away how the hook is grabbed, for easier testing in the future.

Functions

func AddHooksTo

func AddHooksTo(logger *logrus.Logger, config *appconf.SourcesApiConfig)

func InitLogger

func InitLogger(config *appconf.SourcesApiConfig)

Types

type EchoLogger

type EchoLogger struct {
	*logrus.Entry
}

func (EchoLogger) Debugj

func (el EchoLogger) Debugj(j log.JSON)

func (EchoLogger) Errorj

func (el EchoLogger) Errorj(j log.JSON)

func (EchoLogger) Fatalj

func (el EchoLogger) Fatalj(j log.JSON)

func (EchoLogger) Infoj

func (el EchoLogger) Infoj(j log.JSON)

func (EchoLogger) Level

func (el EchoLogger) Level() log.Lvl

func (EchoLogger) Output

func (el EchoLogger) Output() io.Writer

func (EchoLogger) Panicj

func (el EchoLogger) Panicj(j log.JSON)

func (EchoLogger) Prefix

func (el EchoLogger) Prefix() string

func (EchoLogger) Printj

func (el EchoLogger) Printj(j log.JSON)

Wrapping _level_j methods

func (EchoLogger) SetHeader

func (el EchoLogger) SetHeader(_ string)

we don't set a header on the logger either

func (EchoLogger) SetLevel

func (el EchoLogger) SetLevel(log.Lvl)

we don't use the "set level" on the echo logger since we're using a single unified logger

func (EchoLogger) SetOutput

func (el EchoLogger) SetOutput(out io.Writer)

output is easy

func (EchoLogger) SetPrefix

func (el EchoLogger) SetPrefix(string)

we don't set a prefix ever on the logger

func (EchoLogger) Warnj

func (el EchoLogger) Warnj(j log.JSON)

type GormLogger

type GormLogger struct {
	Logger                  *logrus.Logger
	SlowThreshold           time.Duration
	SkipErrorRecordNotFound bool
}

func (*GormLogger) Debug

func (l *GormLogger) Debug(ctx context.Context, logMessage string, data ...interface{})

Functions implementing the rest of the gorm logger interface - not used unless you were to call `DB.Logger.Info(...)`, which we don't use. Everything else goes through Trace

func (*GormLogger) Error

func (l *GormLogger) Error(ctx context.Context, logMessage string, data ...interface{})

func (*GormLogger) Info

func (l *GormLogger) Info(ctx context.Context, logMessage string, data ...interface{})

func (*GormLogger) LogMode

func (*GormLogger) Trace

func (l *GormLogger) Trace(ctx context.Context, begin time.Time, fc func() (sql string, rowsAffected int64), err error)

Trace runs a SQL query and logs how long it took as well as the sql executed. By default the log entry is debug, but if the SQL is very slow it will log as warn.

func (*GormLogger) Warn

func (l *GormLogger) Warn(ctx context.Context, logMessage string, data ...interface{})

type LogFormatter

type LogFormatter struct {
	Hostname string
	AppName  string
	LogType  string
}

func (*LogFormatter) Format

func (f *LogFormatter) Format(entry *logrus.Entry) ([]byte, error)

type Marshaler

type Marshaler interface {
	MarshalLog() map[string]interface{}
}

Marshaler is an interface any type can implement to change its output in our production logs.

Jump to

Keyboard shortcuts

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