Documentation ¶
Overview ¶
Package log
Package log ¶
Package log ¶
Package log ¶
Package log
Index ¶
- Constants
- Variables
- func ConvertConfig(op Option) zap.Config
- func DefaultEncodeConfig() zapcore.EncoderConfig
- func ModuleName() string
- func NewZap(c zap.Config, op ...zap.Option) (*zap.Logger, error)
- type Level
- type Logger
- func (l Logger) Error(v ...interface{})
- func (l Logger) ErrorF(fmtStr string, v ...interface{})
- func (l Logger) Info(v ...interface{})
- func (l Logger) InfoF(fmtStr string, v ...interface{})
- func (l *Logger) Init() error
- func (l Logger) Warn(v ...interface{})
- func (l Logger) WarnF(fmtStr string, v ...interface{})
- type Option
Constants ¶
View Source
const EncodingConsole = "console"
View Source
const EncodingJSON = "json"
Variables ¶
View Source
var DefaultOption = Option{ Development: false, Level: InfoLevel, StackTrace: false, Encoding: EncodingJSON, Output: DefaultOutput, EncodeConfig: zapEncodeConfig, }
DefaultOption 默认配置
View Source
var DefaultOutput = []string{"stderr"}
View Source
var DevOption = Option{ Development: true, Level: DebugLevel, StackTrace: true, Encoding: EncodingJSON, Output: DefaultOutput, EncodeConfig: zapEncodeConfig, }
Functions ¶
func ConvertConfig ¶
ConvertConfig 从fushin option转为zap config
func DefaultEncodeConfig ¶
func DefaultEncodeConfig() zapcore.EncoderConfig
func ModuleName ¶
func ModuleName() string
Types ¶
type Level ¶
type Level int8
const ( // DebugLevel logs are typically voluminous, and are usually disabled in // production. DebugLevel Level = iota - 1 // InfoLevel is the default logging priority. InfoLevel // WarnLevel logs are more important than Info, but don't need individual // human review. WarnLevel // ErrorLevel logs are high-priority. If an application is running smoothly, // it shouldn't generate any error-level logs. ErrorLevel // DPanicLevel logs are particularly important errors. In development the // logger panics after writing the message. DPanicLevel // PanicLevel logs a message, then panics. PanicLevel // FatalLevel logs a message, then calls os.Exit(1). FatalLevel )
Click to show internal directories.
Click to hide internal directories.