logger

package
v0.0.0-...-1770afa Latest Latest
Warning

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

Go to latest
Published: Jan 20, 2022 License: MIT Imports: 15 Imported by: 0

Documentation

Overview

file.go

fileWriter

timewriter.go

option.go

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Compress

func Compress(src, dst string, isDelSrc bool) (err error)

func Pwd

func Pwd() string

Pwd() 获取可执行程序所在路径

Types

type FileWriter

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

func (*FileWriter) Close

func (fw *FileWriter) Close() error

func (*FileWriter) Debug

func (fw *FileWriter) Debug(msg JSONP) (int, error)

func (*FileWriter) Error

func (fw *FileWriter) Error(msg JSONP) (int, error)

func (*FileWriter) Fatal

func (fw *FileWriter) Fatal(msg JSONP)

func (*FileWriter) Info

func (fw *FileWriter) Info(msg JSONP) (int, error)

func (*FileWriter) Log

func (fw *FileWriter) Log(level LogLevel, msg JSONP) (int, error)

func (*FileWriter) Msg

func (fw *FileWriter) Msg(msg string) (int, error)

func (*FileWriter) Panic

func (fw *FileWriter) Panic(msg JSONP)

func (*FileWriter) SetLevel

func (fw *FileWriter) SetLevel(level LogLevel)

func (*FileWriter) Warn

func (fw *FileWriter) Warn(msg JSONP) (int, error)

func (*FileWriter) Write

func (fw *FileWriter) Write(p []byte) (int, error)

type JSONP

type JSONP = map[string]interface{}

type LogLevel

type LogLevel int
const (
	LEVEL_DEBUG LogLevel = iota
	LEVEL_INFO
	LEVEL_WARN
	LEVEL_ERROR
	LEVEL_PANIC
	LEVEL_FATAL
)

type LogWriter

type LogWriter interface {
	Write(p []byte) (int, error)
	Close() error
	Msg(string) (int, error)
	Info(msg JSONP) (int, error)
	Debug(msg JSONP) (int, error)
	Warn(msg JSONP) (int, error)
	Error(msg JSONP) (int, error)
	Log(level LogLevel, msg JSONP) (int, error)
	Fatal(msg JSONP)
	Panic(msg JSONP)
	SetLevel(level LogLevel)
}

func GetDefaultLogger

func GetDefaultLogger() LogWriter

func NewLogFile

func NewLogFile(optinos ...OptionFileFN) LogWriter

type OptionFileFN

type OptionFileFN func(*FileWriter)

func WithLevel

func WithLevel(level LogLevel) OptionFileFN

func WithMaxBackups

func WithMaxBackups(backups int) OptionFileFN

func WithMaxSize

func WithMaxSize(sizeMB int) OptionFileFN

func WithPath

func WithPath(path string) OptionFileFN

func WithPreName

func WithPreName(name string) OptionFileFN

func WithSplitBySize

func WithSplitBySize() OptionFileFN

Jump to

Keyboard shortcuts

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