Documentation
¶
Index ¶
- func DPanic(template string, args ...any)
- func DPanicw(msg string, keysAndValues ...any)
- func Debug(template string, args ...any)
- func Debugw(msg string, keysAndValues ...any)
- func Enable(level zapcore.Level) bool
- func Error(template string, args ...any)
- func Errorw(msg string, keysAndValues ...any)
- func Fatal(template string, args ...any)
- func Fatalw(msg string, keysAndValues ...any)
- func Flush()
- func GetLevel(level string) zapcore.Level
- func Info(template string, args ...any)
- func Infow(msg string, keysAndValues ...any)
- func NewSugaredLogger(core zapcore.Core, opts ...zap.Option) *zap.SugaredLogger
- func Panic(template string, args ...any)
- func Panicw(msg string, keysAndValues ...any)
- func PrintLevel(level zapcore.Level) bool
- func SetFileNameVar(key, value string)
- func SetNodeLogger(node cfacade.INode)
- func Warn(template string, args ...any)
- func Warnw(msg string, keysAndValues ...any)
- type ActorLogger
- type Config
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func DPanic ¶
DPanic uses fmt.Sprintf to log a templated message. In development, the logger then panics. (See DPanicLevel for details.)
func DPanicw ¶
DPanicw logs a message with some additional context. In development, the logger then panics. (See DPanicLevel for details.) The variadic key-value pairs are treated as they are in With.
func Debugw ¶
Debugw logs a message with some additional context. The variadic key-value pairs are treated as they are in With.
When debug-level logging is disabled, this is much faster than
s.With(keysAndValues).Debug(msg)
func Errorw ¶
Errorw logs a message with some additional context. The variadic key-value pairs are treated as they are in With.
func Fatalw ¶
Fatalw logs a message with some additional context, then calls os.Exit. The variadic key-value pairs are treated as they are in With.
func Infow ¶
Infow logs a message with some additional context. The variadic key-value pairs are treated as they are in With.
func NewSugaredLogger ¶
func Panicw ¶
Panicw logs a message with some additional context, then panics. The variadic key-value pairs are treated as they are in With.
func PrintLevel ¶
func SetFileNameVar ¶
func SetFileNameVar(key, value string)
func SetNodeLogger ¶
Types ¶
type ActorLogger ¶
type ActorLogger struct {
*zap.SugaredLogger
*Config
}
var (
DefaultLogger *ActorLogger // 默认日志对象(控制台输出)
)
func NewConfigLogger ¶
func NewConfigLogger(config *Config, opts ...zap.Option) *ActorLogger
func (*ActorLogger) Print ¶
func (c *ActorLogger) Print(v ...any)
type Config ¶
type Config struct {
LogLevel string `json:"level"` // 输出日志等级
StackLevel string `json:"stack_level"` // 堆栈输出日志等级
EnableConsole bool `json:"enable_console"` // 是否控制台输出
EnableWriteFile bool `json:"enable_write_file"` // 是否输出文件(必需配置FilePath)
MaxAge int `json:"max_age"` // 最大保留天数(达到限制,则会被清理)
TimeFormat string `json:"time_format"` // 打印时间输出格式
PrintCaller bool `json:"print_caller"` // 是否打印调用函数
RotationTime int `json:"rotation_time"` // 日期分割时间(秒)
FileLinkPath string `json:"file_link_path"` // 日志文件连接路径
FilePathFormat string `json:"file_path_format"` // 日志文件路径格式
IncludeStdout bool `json:"include_stdout"` // 是否包含os.stdout输出
IncludeStderr bool `json:"include_stderr"` // 是否包含os.stderr输出
}
func NewConfigWithName ¶
func (*Config) TimeEncoder ¶
func (c *Config) TimeEncoder() zapcore.TimeEncoder
Directories
¶
| Path | Synopsis |
|---|---|
|
Package rotatelogs is a port of File-RotateLogs from Perl (https://metacpan.org/release/File-RotateLogs), and it allows you to automatically rotate output files when you write to them according to the filename pattern that you can specify.
|
Package rotatelogs is a port of File-RotateLogs from Perl (https://metacpan.org/release/File-RotateLogs), and it allows you to automatically rotate output files when you write to them according to the filename pattern that you can specify. |