Documentation ¶
Overview ¶
Package logger
@author: xwc1125
Package logger ¶
@author: xwc1125
Package logger ¶
@author: xwc1125
Package logger ¶
@author: xwc1125
Package logger ¶
@author: xwc1125
Package logger ¶
@author: xwc1125
Index ¶
- Constants
- Variables
- func ColorRender(str string, color int, weight int, extraArgs ...interface{}) string
- func Crit(msg string, ctx ...interface{})
- func CurrentTime() int64
- func Debug(msg string, ctx ...interface{})
- func Error(msg string, ctx ...interface{})
- func Fatal(v ...interface{})
- func Fatalf(format string, v ...interface{})
- func Fatalln(v ...interface{})
- func GetColorByLevel(level Lvl) int
- func GetWriter(fileConfig FileLogConfig) (io.WriteCloser, error)
- func Info(msg string, ctx ...interface{})
- func Panic(v ...interface{})
- func Panicf(format string, v ...interface{})
- func Panicln(v ...interface{})
- func Print(v ...interface{})
- func Printf(format string, v ...interface{})
- func Println(v ...interface{})
- func SwitchLog(logKitName string)
- func ToString(i interface{}) string
- func ToStringE(i interface{}) (string, error)
- func Trace(msg string, ctx ...interface{})
- func Warn(msg string, ctx ...interface{})
- type ConsoleLogConfig
- type FileLogConfig
- type LogConfig
- type Logger
- type Lvl
Constants ¶
View Source
const ( TermMsgJust = 44 DefaultTimestampFormat = time.RFC3339 DefaultTermTimestampFormat = "2006-01-02 15:04:05.000" FieldKeyMsg = "msg" FieldKeyLevel = "lvl" FieldKeyTime = "t" FieldKeyFile = "f" FieldKeyModule = "module" FieldKeyError = "err" )
Variables ¶
View Source
var DefaultLogConfig = &LogConfig{ Console: ConsoleLogConfig{ Level: 3, Modules: "*", ShowPath: false, UseColor: false, Console: true, }, }
Functions ¶
func ColorRender ¶
func GetColorByLevel ¶
func GetWriter ¶
func GetWriter(fileConfig FileLogConfig) (io.WriteCloser, error)
Types ¶
type ConsoleLogConfig ¶
type ConsoleLogConfig struct { Level Lvl `json:"level" mapstructure:"level"` // log level Modules string `json:"modules" mapstructure:"modules"` // need to show modules。"*":all ShowPath bool `json:"show_path" mapstructure:"show_path"` // show path Format string `json:"format" mapstructure:"format"` // format UseColor bool `json:"use_color" mapstructure:"use_color"` // show console color Console bool `json:"console" mapstructure:"console"` // show console }
func (*ConsoleLogConfig) GetModules ¶
func (c *ConsoleLogConfig) GetModules() []string
type FileLogConfig ¶
type FileLogConfig struct { Level Lvl `json:"level" mapstructure:"level"` // log level Format string `json:"format" mapstructure:"format"` // format Save bool `json:"save" mapstructure:"save"` // whether save file FilePath string `json:"file_path" mapstructure:"file_path"` // filepath FileName string `json:"file_name" mapstructure:"file_name"` // filename prefix MaxAge int64 `json:"max_age" mapstructure:"max_age"` // 文件最大保存时间[小时] RotationTime int64 `json:"rotation_time" mapstructure:"rotation_time"` // 日志切割时间间隔[小时] }
func (*FileLogConfig) GetLogFile ¶
func (c *FileLogConfig) GetLogFile() string
func (*FileLogConfig) GetMaxAge ¶
func (c *FileLogConfig) GetMaxAge() int64
func (*FileLogConfig) GetRotationTime ¶
func (c *FileLogConfig) GetRotationTime() int64
type LogConfig ¶
type LogConfig struct { Console ConsoleLogConfig `json:"console" mapstructure:"console"` File FileLogConfig `json:"file" mapstructure:"file"` }
LogConfig log config
type Logger ¶
type Logger interface { Name() string New(module string, ctx ...interface{}) Logger Trace(msg string, ctx ...interface{}) Debug(msg string, ctx ...interface{}) Info(msg string, ctx ...interface{}) Warn(msg string, ctx ...interface{}) Error(msg string, ctx ...interface{}) Crit(msg string, ctx ...interface{}) Printf(format string, v ...interface{}) Print(v ...interface{}) Println(v ...interface{}) Fatal(v ...interface{}) Fatalf(format string, v ...interface{}) Fatalln(v ...interface{}) Panic(v ...interface{}) Panicf(format string, v ...interface{}) Panicln(v ...interface{}) }
Source Files ¶
Directories ¶
Path | Synopsis |
---|---|
Package log15 @author: xwc1125
|
Package log15 @author: xwc1125 |
Package logrus @author: xwc1125 @date: 2021/8/30 Package logrus @author: xwc1125 @date: 2021/9/2 Package logrus @author: xwc1125 @date: 2021/8/30
|
Package logrus @author: xwc1125 @date: 2021/8/30 Package logrus @author: xwc1125 @date: 2021/9/2 Package logrus @author: xwc1125 @date: 2021/8/30 |
Package zap @author: xwc1125 Package zap @author: xwc1125
|
Package zap @author: xwc1125 Package zap @author: xwc1125 |
bufferpool
Package bufferpool houses zap's shared internal buffer pool.
|
Package bufferpool houses zap's shared internal buffer pool. |
Click to show internal directories.
Click to hide internal directories.