logger

package
v1.0.0-beta.10 Latest Latest
Warning

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

Go to latest
Published: Nov 3, 2022 License: Apache-2.0 Imports: 6 Imported by: 4

Documentation

Index

Constants

View Source
const DebugEnv = "SCW_DEBUG"

Variables

View Source
var DefaultLogger = newLogger(os.Stderr, LogLevelWarning)

Functions

func Debugf

func Debugf(format string, args ...interface{})

Debugf logs to the DEBUG log. Arguments are handled in the manner of fmt.Printf.

func EnableDebugMode

func EnableDebugMode()

EnableDebugMode enable LogLevelDebug on the default logger. If a custom logger was provided with SetLogger this method has no effect.

func Errorf

func Errorf(format string, args ...interface{})

Errorf logs to the ERROR log. Arguments are handled in the manner of fmt.Printf.

func Infof

func Infof(format string, args ...interface{})

Infof logs to the INFO log. Arguments are handled in the manner of fmt.Printf.

func SetLogger

func SetLogger(l Logger)

SetLogger sets logger that is used in by the SDK. Not mutex-protected, should be called before any scaleway-sdk-go functions.

func ShouldLog

func ShouldLog(level LogLevel) bool

ShouldLog reports whether verbosity level l is at least the requested verbose level.

func Warningf

func Warningf(format string, args ...interface{})

Warningf logs to the WARNING log. Arguments are handled in the manner of fmt.Printf.

Types

type LogLevel

type LogLevel int
const (
	// LogLevelDebug indicates Debug severity.
	LogLevelDebug LogLevel = iota
	// LogLevelInfo indicates Info severity.
	LogLevelInfo
	// LogLevelWarning indicates Warning severity.
	LogLevelWarning
	// LogLevelError indicates Error severity.
	LogLevelError
)

type Logger

type Logger interface {
	// Debugf logs to DEBUG log. Arguments are handled in the manner of fmt.Printf.
	Debugf(format string, args ...interface{})
	// Infof logs to INFO log. Arguments are handled in the manner of fmt.Printf.
	Infof(format string, args ...interface{})
	// Warningf logs to WARNING log. Arguments are handled in the manner of fmt.Printf.
	Warningf(format string, args ...interface{})
	// Errorf logs to ERROR log. Arguments are handled in the manner of fmt.Printf.
	Errorf(format string, args ...interface{})
	// ShouldLog reports whether verbosity level l is at least the requested verbose level.
	ShouldLog(level LogLevel) bool
}

Logger does underlying logging work for scaleway-sdk-go.

Jump to

Keyboard shortcuts

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