log

package
v0.0.0-...-71d5ba4 Latest Latest
Warning

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

Go to latest
Published: Sep 12, 2018 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

View Source
const (
	KB = 1 << (10 * iota)
	MB
	GB
	TB
)

Variables

This section is empty.

Functions

func D

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

func E

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

func I

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

func W

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

Types

type Config

type Config struct {
	Level              Level
	OutputType         OutputType
	LogFileRollingType RollingType
	LogFileOutputDir   string
	LogFileName        string
	LogFileMaxSize     int64 // 字节
}

type Level

type Level int
const (
	Info Level = iota
	Debug
	Warning
	Error
)

type Logger

type Logger interface {
	SetLevel(level Level)
	SetPrefixes(prefix ...string)
	I(format string, v ...interface{})
	D(format string, v ...interface{})
	W(format string, v ...interface{})
	E(format string, v ...interface{})
	Close()
}
var DefaultLogger Logger

func NewLogger

func NewLogger(config *Config) Logger

type OutputLog

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

type OutputType

type OutputType int
const (
	Console OutputType = 1 << iota
	File
)

type RollingType

type RollingType int
const (
	RollingNone              = 0
	RollingDaily RollingType = 1 << iota
	RollingSize
)

Jump to

Keyboard shortcuts

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