Documentation ¶
Overview ¶
package nazalog 日志库
Index ¶
- Variables
- func Debug(v ...interface{})
- func Debugf(format string, v ...interface{})
- func Error(v ...interface{})
- func Errorf(format string, v ...interface{})
- func Fatal(v ...interface{})
- func FatalIfErrorNotNil(err error)
- func Fatalf(format string, v ...interface{})
- func Info(v ...interface{})
- func Infof(format string, v ...interface{})
- func Init(modOptions ...ModOption) error
- func Out(level Level, calldepth int, s string)
- func Output(level Level, calldepth int, v ...interface{})
- func Outputf(level Level, calldepth int, format string, v ...interface{})
- func Panic(v ...interface{})
- func PanicIfErrorNotNil(err error)
- func Panicf(format string, v ...interface{})
- func Warn(v ...interface{})
- func Warnf(format string, v ...interface{})
- type Level
- type Logger
- type ModOption
- type Option
Constants ¶
This section is empty.
Variables ¶
View Source
var ErrLog = errors.New("naza.log:fxxk")
Functions ¶
func FatalIfErrorNotNil ¶
func FatalIfErrorNotNil(err error)
func PanicIfErrorNotNil ¶
func PanicIfErrorNotNil(err error)
Types ¶
type Level ¶
type Level uint8
const ( LevelDebug Level // 1 LevelInfo LevelWarn LevelError LevelFatal LevelPanic )
type Logger ¶
type Logger interface { Debugf(format string, v ...interface{}) Infof(format string, v ...interface{}) Warnf(format string, v ...interface{}) Errorf(format string, v ...interface{}) Fatalf(format string, v ...interface{}) // 打印日志并退出程序 Panicf(format string, v ...interface{}) Debug(v ...interface{}) Info(v ...interface{}) Warn(v ...interface{}) Error(v ...interface{}) Fatal(v ...interface{}) Panic(v ...interface{}) FatalIfErrorNotNil(err error) PanicIfErrorNotNil(err error) Outputf(level Level, calldepth int, format string, v ...interface{}) Output(level Level, calldepth int, v ...interface{}) Out(level Level, calldepth int, s string) }
type Option ¶
type Option struct { Level Level `json:"level"` // 日志级别,大于等于该级别的日志才会被输出 // 文件输出和控制台输出可同时打开 // 控制台输出主要用做开发时调试,打开后level字段使用彩色输出 Filename string `json:"filename"` // 输出日志文件名,如果为空,则不写日志文件。可包含路径,路径不存在时,将自动创建 IsToStdout bool `json:"is_to_stdout"` // 是否以stdout输出到控制台 IsRotateDaily bool `json:"is_rotate_daily"` // 日志按天翻转 ShortFileFlag bool `json:"short_file_flag"` // 是否在每行日志尾部添加源码文件及行号的信息 }
Click to show internal directories.
Click to hide internal directories.