Documentation ¶
Overview ¶
Package log is a structured logger for Go, completely API compatible with the standard library logger.
The simplest way to use log is simply the package-level exported logger:
package main
import "github.com/lkcloud/log"
func main() { log.Info("this is a test message", "level", "info") }
Output:
2019-06-25 11:43:11.170 INFO example/simple.go:6 this is a test message {"level": "info"}
For a full guide visit https://github.com/lkcloud/log
Index ¶
- func Debug(msg string, keysAndValues ...interface{})
- func Debugf(format string, args ...interface{})
- func Dump(msg string, keysAndValues ...interface{})
- func Dumpf(format string, args ...interface{})
- func Error(msg string, keysAndValues ...interface{})
- func Errorf(format string, args ...interface{})
- func Fatal(msg string, keysAndValues ...interface{})
- func Fatalf(format string, args ...interface{})
- func GetOptions() string
- func Info(msg string, keysAndValues ...interface{})
- func Infof(format string, args ...interface{})
- func NewDevelopment(projectName, filePath string)
- func NewProduction(projectName, filePath string)
- func Panic(msg string, keysAndValues ...interface{})
- func Panicf(format string, args ...interface{})
- func Reset()
- func SetLogLevel(level options.Level)
- func SetLogger(opts ...options.Option)
- func SetLoggerWithOptions(o *options.Options, opts ...options.Option)
- func Sync()
- func Warn(msg string, keysAndValues ...interface{})
- func Warnf(format string, args ...interface{})
- type Loger
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func GetOptions ¶
func GetOptions() string
Types ¶
type Loger ¶
type Loger interface { //key value Debug(string, ...interface{}) //调试的 Info(string, ...interface{}) //提示的 Warn(string, ...interface{}) //警告的 Error(string, ...interface{}) //错误的 Panic(string, ...interface{}) //恐慌的 Fatal(string, ...interface{}) //致命的 Dump(string, ...interface{}) //详细结构类型,调试利器 // format output Debugf(string, ...interface{}) //调试的 Infof(string, ...interface{}) //提示的 Warnf(string, ...interface{}) //警告的 Errorf(string, ...interface{}) //错误的 Panicf(string, ...interface{}) //恐慌的 Fatalf(string, ...interface{}) //致命的 Dumpf(string, ...interface{}) //详细结构类型,调试利器 Sync() //同步 Options() string SetLogLevel(options.Level) //可以随机设置日志级别的 }
定义接口
Click to show internal directories.
Click to hide internal directories.