log

package
v0.0.0-...-625ea8d Latest Latest
Warning

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

Go to latest
Published: Mar 3, 2020 License: Apache-2.0 Imports: 1 Imported by: 0

Documentation

Overview

Package log is a global internal logger

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Error

func Error(v ...interface{})

Error error

func Errorf

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

Errorf errorf

func Fatal

func Fatal(v ...interface{})

Fatal fatal

func Fatalf

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

Fatalf fatalf

func Info

func Info(v ...interface{})

Info info

func Infof

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

Infof infof

func SetLogger

func SetLogger(l Logger)

SetLogger sets the local logger

Types

type LevelType

type LevelType int

LevelType level type

const (
	// TraceLevel trace level
	TraceLevel LevelType = iota
	// DebugLevel debug level
	DebugLevel
	// InfoLevel info level
	InfoLevel
	// WarnLevel warn level
	WarnLevel
	// ErrorLevel error level
	ErrorLevel
	// FatalLevel fatal level
	FatalLevel
	// PanicLevel panic level
	PanicLevel
)

type Logger

type Logger interface {
	Init(opts ...Option) error
	Info(v ...interface{})
	Infof(format string, v ...interface{})
	Error(v ...interface{})
	Errorf(format string, v ...interface{})
	Fatal(v ...interface{})
	Fatalf(format string, v ...interface{})
	String() string
}

Logger logger interface

var DefaultLogger Logger

DefaultLogger default logger

func GetLogger

func GetLogger() Logger

GetLogger returns the local logger

type Option

type Option func(*Options)

Option option

func Level

func Level(level LevelType) Option

Level level

func Name

func Name(name string) Option

Name log name

func ToStdOut

func ToStdOut(v bool) Option

ToStdOut log to stdout

type Options

type Options struct {
	Name     string
	Level    LevelType
	ToStdOut bool

	// Other options for implementations of the interface
	// can be stored in a context
	Context context.Context
}

Options options

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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