log

package
Version: v1.3.0 Latest Latest
Warning

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

Go to latest
Published: Jun 10, 2021 License: Apache-2.0 Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (

	// DefaultErrorLogger is a default logger for Bucketeer SDK error logs.
	// For example, DefaultErrorLogger outputs,
	//   [ERROR] 2021/01/01 10:00:00 message
	//
	// DefaultErrorLoger implements BaseLogger interface.
	DefaultErrorLogger = stdlog.New(os.Stderr, "[ERROR] ", flags)

	// DiscardErrorLogger discards all Bucketeer SDK error logs.
	//
	// DiscardErrorLoger implements BaseLogger interface.
	DiscardErrorLogger = stdlog.New(ioutil.Discard, "[ERROR] ", flags)
)

Functions

This section is empty.

Types

type BaseLogger

type BaseLogger interface {
	// Print outputs a message.
	//
	// Print is equivalent to log.Logger.Print in the standard library.
	Print(values ...interface{})

	// Printf outputs a message, applying a format string.
	//
	// Printf is equivalent to log.Logger.Printf in the standard library.
	Printf(format string, values ...interface{})
}

BaseLogger is a generic logger interface with no level mechanism.

Since BaseLogger's methods are a subset of log.Logger in the standard library, you can use log.New() to create a BaseLogger, or you can implement a custom BaseLogger.

type Loggers

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

Loggers is a logging compornent used in the Bucketeer SDK.

Debug logs are for Bucketeer SDK developers. Error logs are for Bucketeer SDK users.

func NewLoggers

func NewLoggers(conf *LoggersConfig) *Loggers

NewLoggers creates a new Loggers.

func (*Loggers) Debug

func (l *Loggers) Debug(values ...interface{})

Debug outputs a debug log.

func (*Loggers) Debugf

func (l *Loggers) Debugf(format string, values ...interface{})

Debugf outputs a formatted debug log.

func (*Loggers) Error

func (l *Loggers) Error(values ...interface{})

Error outputs a error log.

func (*Loggers) Errorf

func (l *Loggers) Errorf(format string, values ...interface{})

Errorf outputs a formatted error log.

type LoggersConfig

type LoggersConfig struct {
	// EnableDebugLog enables debug logs if true.
	EnableDebugLog bool

	// ErrorLogger is used to output error logs.
	ErrorLogger BaseLogger
}

LoggersConfig is the config for Loggers.

Source Files

Jump to

Keyboard shortcuts

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