logging

package
v2.50.1 Latest Latest
Warning

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

Go to latest
Published: Oct 28, 2024 License: Apache-2.0 Imports: 3 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ConfigOption

type ConfigOption func(*LogrusLogger)

func ConfigLoggerInstance

func ConfigLoggerInstance(logger *log.Logger) ConfigOption

type Logger

type Logger interface {
	Error(string, ...interface{})
	Warn(string, ...interface{})
	Info(string, ...interface{})
	Debug(string, ...interface{})
	Trace(string, ...interface{})
	SetLevel(string)
}

Logger interface implements a simple logger.

type LogrusLogger

type LogrusLogger struct {
	// contains filtered or unexported fields
}

LogrusLogger is a logger based on logrus.

func NewLogrusLogger

func NewLogrusLogger(opts ...ConfigOption) *LogrusLogger

NewLogrusLogger creates a new structured logger.

func (LogrusLogger) Debug

func (l LogrusLogger) Debug(msg string, fields ...interface{})

Debug logs a debug message.

func (LogrusLogger) Error

func (l LogrusLogger) Error(msg string, fields ...interface{})

Error logs an error message.

func (LogrusLogger) Info

func (l LogrusLogger) Info(msg string, fields ...interface{})

Info logs an info message.

func (LogrusLogger) SetDefaultFields

func (l LogrusLogger) SetDefaultFields(defaultFields map[string]string)

SetDefaultFields sets fields to be logged on every use of the logger.

func (LogrusLogger) SetLevel

func (l LogrusLogger) SetLevel(levelName string)

SetLevel allows the log level to be set.

func (LogrusLogger) SetLogJSON

func (l LogrusLogger) SetLogJSON(value bool)

LogJSON determines whether or not to format the logs as JSON.

func (LogrusLogger) Trace

func (l LogrusLogger) Trace(msg string, fields ...interface{})

Trace logs a trace message.

func (LogrusLogger) Warn

func (l LogrusLogger) Warn(msg string, fields ...interface{})

Warn logs an warning message.

type MockLogger

type MockLogger struct {
	// contains filtered or unexported fields
}

func NewMockLogger

func NewMockLogger(t *testing.T) *MockLogger

func (MockLogger) Debug

func (l MockLogger) Debug(msg string, fields ...interface{})

Debug logs a debug message.

func (MockLogger) Error

func (l MockLogger) Error(msg string, fields ...interface{})

Error logs an error message.

func (MockLogger) Info

func (l MockLogger) Info(msg string, fields ...interface{})

Info logs an info message.

func (MockLogger) SetLevel

func (l MockLogger) SetLevel(logLevel string)

func (MockLogger) Trace

func (l MockLogger) Trace(msg string, fields ...interface{})

Trace logs a trace message.

func (MockLogger) Warn

func (l MockLogger) Warn(msg string, fields ...interface{})

Warn logs an warning message.

Jump to

Keyboard shortcuts

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