log: github.com/fagongzi/log Index | Files

package log

import "github.com/fagongzi/log"

Index

Package Files

crash_unix.go log.go log_prefix.go util.go

Constants

const (
    // Ldate flags
    Ldate = log.Ldate
    // Llongfile flags
    Llongfile = log.Llongfile
    // Lmicroseconds flags
    Lmicroseconds = log.Lmicroseconds
    // Lshortfile flags
    Lshortfile = log.Lshortfile
    // LstdFlags flags
    LstdFlags = log.LstdFlags
    // Ltime flags
    Ltime = log.Ltime
)
const (
    // LogNone log nothing
    LogNone = Level(0x0)
    // LogFatal log fatal
    LogFatal = LogNone | Level(fatalLevel)
    // LogError log error & fatal
    LogError = LogFatal | Level(errorLevel)
    // LogWarn log warn & error & fatal
    LogWarn = LogError | Level(warnLevel)
    // LogInfo log info & warn & error & fatal
    LogInfo = LogWarn | Level(infoLevel)
    // LogDebug log debug & info & warn & error & fatal
    LogDebug = LogInfo | Level(debugLevel)
    // LogAll log all
    LogAll = LogDebug
)

func CrashLog Uses

func CrashLog(file string)

CrashLog set crash log

func Debug Uses

func Debug(v ...interface{})

Debug debug

func DebugEnabled Uses

func DebugEnabled() bool

DebugEnabled debug enabled

func Debugf Uses

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

Debugf debugf

func Error Uses

func Error(v ...interface{})

Error error

func ErrorEnabled Uses

func ErrorEnabled() bool

ErrorEnabled error enabled

func Errorf Uses

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

Errorf errorf

func Fatal Uses

func Fatal(v ...interface{})

Fatal fatal

func FatalEnabled Uses

func FatalEnabled() bool

FatalEnabled fatal enabled

func Fatalf Uses

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

Fatalf fatalf

func Info Uses

func Info(v ...interface{})

Info info

func InfoEnabled Uses

func InfoEnabled() bool

InfoEnabled info enabled

func Infof Uses

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

Infof infof

func InitLog Uses

func InitLog()

InitLog init log

func SetFlags Uses

func SetFlags(flags int)

SetFlags set log flags

func SetHighlighting Uses

func SetHighlighting(highlighting bool)

SetHighlighting set highlighting log

func SetLevel Uses

func SetLevel(level Level)

SetLevel set current log level

func SetLevelByString Uses

func SetLevelByString(level string)

SetLevelByString set log by string level

func SetOutput Uses

func SetOutput(out io.Writer)

SetOutput set log file use a writer

func SetOutputByName Uses

func SetOutputByName(path string) error

SetOutputByName set log file use file name

func SetRotateByDay Uses

func SetRotateByDay()

SetRotateByDay set default log rotate by day

func SetRotateByHour Uses

func SetRotateByHour()

SetRotateByHour set default log rotate by hour

func WarnEnabled Uses

func WarnEnabled() bool

WarnEnabled warn enabled

func Warning Uses

func Warning(v ...interface{})

Warning warning

func Warningf Uses

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

Warningf warningf

type Cfg Uses

type Cfg struct {
    LogLevel string
    LogFile  string
}

Cfg is the log cfg

type Level Uses

type Level int

Level log level

func GetLogLevel Uses

func GetLogLevel() Level

GetLogLevel get current log level

type Logger Uses

type Logger interface {
    FatalEnabled() bool
    ErrorEnabled() bool
    WarnEnabled() bool
    InfoEnabled() bool
    DebugEnabled() bool

    Info(v ...interface{})
    Infof(format string, v ...interface{})
    Debug(v ...interface{})
    Debugf(format string, v ...interface{})
    Warning(v ...interface{})
    Warningf(format string, v ...interface{})
    Error(v ...interface{})
    Errorf(format string, v ...interface{})
    Fatal(v ...interface{})
    Fatalf(format string, v ...interface{})
}

Logger logger interface

func NewLoggerWithPrefix Uses

func NewLoggerWithPrefix(prefix string) Logger

NewLoggerWithPrefix returns a logger with prefix

type Type Uses

type Type int

Type log type

Package log imports 9 packages (graph) and is imported by 21 packages. Updated 2019-12-11. Refresh now. Tools for package owners.