logger

package
v0.3.1 Latest Latest
Warning

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

Go to latest
Published: Jul 23, 2019 License: Apache-2.0 Imports: 6 Imported by: 0

README

Logger

Logger is a warpper package for sirupsen/logrus

Documentation

Index

Constants

View Source
const (
	DebugLevelString = "debug"
	InfoLevelString  = "info"
	WarnLevelString  = "warn"
	ErrorLevelString = "error"
	FatalLevelString = "fatal"
)

Log level

Variables

This section is empty.

Functions

func LevelToString

func LevelToString(l Level) string

LevelToString convert log level to readable string

Types

type Config

type Config struct {
	Level      Level
	LogFile    string
	TimeFormat string
	Caller     bool
	UseColor   bool
}

Config of logger

type Fields

type Fields map[string]interface{}

Fields type

type Level

type Level int

Level type

const (
	DebugLevel Level = iota
	InfoLevel
	WarnLevel
	ErrorLevel
	FatalLevel
)

level of log

func StringToLevel

func StringToLevel(s string) Level

StringToLevel convert string to log level

type Logger

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

Logger struct

func DefaultLogger

func DefaultLogger() *Logger

DefaultLogger return default value of logger

func New

func New(config *Config) (*Logger, error)

New logger

func (*Logger) Debug

func (l *Logger) Debug(args ...interface{})

Debug function

func (*Logger) Debugf

func (l *Logger) Debugf(format string, v ...interface{})

Debugf function

func (*Logger) Debugln

func (l *Logger) Debugln(args ...interface{})

Debugln function

func (*Logger) Debugw

func (l *Logger) Debugw(message string, fields Fields)

Debugw function

func (*Logger) Error

func (l *Logger) Error(args ...interface{})

Error function

func (*Logger) Errorf

func (l *Logger) Errorf(format string, v ...interface{})

Errorf function

func (*Logger) Errorln

func (l *Logger) Errorln(args ...interface{})

Errorln function

func (*Logger) Errorw

func (l *Logger) Errorw(message string, fields Fields)

Errorw function

func (*Logger) Fatal

func (l *Logger) Fatal(args ...interface{})

Fatal function

func (*Logger) Fatalf

func (l *Logger) Fatalf(format string, v ...interface{})

Fatalf function

func (*Logger) Fatalln

func (l *Logger) Fatalln(args ...interface{})

Fatalln function

func (*Logger) Fatalw

func (l *Logger) Fatalw(message string, fields Fields)

Fatalw function

func (*Logger) Info

func (l *Logger) Info(args ...interface{})

Info function

func (*Logger) Infof

func (l *Logger) Infof(format string, v ...interface{})

Infof function

func (*Logger) Infoln

func (l *Logger) Infoln(args ...interface{})

Infoln function

func (*Logger) Infow

func (l *Logger) Infow(message string, fields Fields)

Infow function

func (*Logger) SetLevel

func (l *Logger) SetLevel(level Level)

SetLevel for setting log level

func (*Logger) SetLevelString

func (l *Logger) SetLevelString(level string)

SetLevelString set level using string instead of level

func (*Logger) SetOutput

func (l *Logger) SetOutput(output io.Writer)

SetOutput for set logger output

func (*Logger) Warn

func (l *Logger) Warn(args ...interface{})

Warn function

func (*Logger) Warnf

func (l *Logger) Warnf(format string, v ...interface{})

Warnf function

func (*Logger) Warnln

func (l *Logger) Warnln(args ...interface{})

Warnln function

func (*Logger) Warnw

func (l *Logger) Warnw(message string, fields Fields)

Warnw function

Jump to

Keyboard shortcuts

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