log

package
v0.22.17 Latest Latest
Warning

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

Go to latest
Published: Apr 23, 2024 License: Apache-2.0 Imports: 3 Imported by: 27

Documentation

Overview

Package log is the log utilities of sdk

Index

Constants

This section is empty.

Variables

View Source
var (
	PanicLevel = Level(logrus.PanicLevel)
	FatalLevel = Level(logrus.FatalLevel)
	ErrorLevel = Level(logrus.ErrorLevel)
	WarnLevel  = Level(logrus.WarnLevel)
	InfoLevel  = Level(logrus.InfoLevel)
	DebugLevel = Level(logrus.DebugLevel)

	SetLevel     = func(level Level) { logrus.SetLevel(logrus.Level(level)) }
	GetLevel     = func() Level { return Level(logrus.GetLevel()) }
	SetOutput    = logrus.SetOutput
	SetFormatter = logrus.SetFormatter

	WithError = logrus.WithError
	WithField = logrus.WithField

	Debug   = logrus.Debug
	Print   = logrus.Print
	Info    = logrus.Info
	Warn    = logrus.Warn
	Warning = logrus.Warning
	Error   = logrus.Error
	Panic   = logrus.Panic
	Fatal   = logrus.Fatal

	Debugf   = logrus.Debugf
	Printf   = logrus.Printf
	Infof    = logrus.Infof
	Warnf    = logrus.Warnf
	Warningf = logrus.Warningf
	Errorf   = logrus.Errorf
	Panicf   = logrus.Panicf
	Fatalf   = logrus.Fatalf
)

Functions

func Init

func Init(level Level)

Init (Deprecated) will init with level and default output (stdout) and formatter (text without color) to global logger

Types

type BasicLogger added in v0.6.7

type BasicLogger struct {
	*logrus.Logger
}

BasicLogger is the logger (wrapper for logrus)

func New added in v0.6.7

func New() *BasicLogger

New will return a logger pointer

func (*BasicLogger) GetLevel added in v0.6.7

func (logger *BasicLogger) GetLevel() Level

GetLevel returns the logger level.

func (*BasicLogger) SetFormatter added in v0.6.7

func (logger *BasicLogger) SetFormatter(formatter Formatter)

SetFormatter sets the logger formatter.

func (*BasicLogger) SetLevel added in v0.6.7

func (logger *BasicLogger) SetLevel(level Level)

SetLevel sets the logger level.

func (*BasicLogger) SetOutput added in v0.6.7

func (logger *BasicLogger) SetOutput(out io.Writer)

SetOutput sets the logger output.

type Formatter added in v0.6.7

type Formatter logrus.Formatter

Formatter is the formatter of logger (wrapper for logrus)

type Level

type Level logrus.Level

Level is the log level of logger (wrapper for logrus)

type Logger added in v0.6.7

type Logger interface {
	Debug(...interface{})
	Print(...interface{})
	Info(...interface{})
	Warn(...interface{})
	Warning(...interface{})
	Error(...interface{})
	Panic(...interface{})
	Fatal(...interface{})

	Debugf(string, ...interface{})
	Printf(string, ...interface{})
	Infof(string, ...interface{})
	Warnf(string, ...interface{})
	Warningf(string, ...interface{})
	Errorf(string, ...interface{})
	Panicf(string, ...interface{})
	Fatalf(string, ...interface{})

	SetOutput(io.Writer)
	SetFormatter(Formatter)
	SetLevel(Level)
	GetLevel() Level
}

Logger is the interface of SDK

Jump to

Keyboard shortcuts

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