Documentation
¶
Index ¶
- Constants
- func Debug(msg string, args ...any)
- func Debugf(format string, args ...any)
- func Error(msg string, args ...any)
- func Errorf(format string, args ...any)
- func Fatal(msg string, args ...any)
- func Fatalf(format string, args ...any)
- func Info(msg string, args ...any)
- func Infof(format string, args ...any)
- func IsConsole(w io.Writer) bool
- func NewTextHandler(opts *Options) slog.Handler
- func Panic(msg string, args ...any)
- func Panicf(format string, args ...any)
- func SafeWriter(w ...io.Writer) *io.PipeWriter
- func Warn(msg string, args ...any)
- func Warnf(format string, args ...any)
- func WithOptions(options *Options)
- type Buffer
- type Color
- type Logger
- func (l *Logger) Debugf(format string, args ...any)
- func (l *Logger) Errorf(format string, args ...any)
- func (l *Logger) Fatal(msg string, args ...any)
- func (l *Logger) Fatalf(format string, args ...any)
- func (l *Logger) Infof(format string, args ...any)
- func (l *Logger) Panic(msg string, args ...any)
- func (l *Logger) Panicf(format string, args ...any)
- func (l *Logger) Print(msg string, args ...any)
- func (l *Logger) Printf(format string, args ...any)
- func (l *Logger) Warnf(format string, args ...any)
- type Option
- type Options
- type Stack
- type TextHandler
- type TimeRotatingWriter
- type XLogger
Constants ¶
View Source
const ( ANSIReset = "\033[0m" ANSIDebug = "\033[90m" ANSIInfo = "\033[32m" ANSIWarn = "\033[33m" ANSIError = "\033[31m" ANSITime = "\033[37m" ANSISource = "\033[34;4m" )
View Source
const (
StackDefaultSkip = 6
)
Variables ¶
This section is empty.
Functions ¶
func NewTextHandler ¶ added in v1.0.3
func SafeWriter ¶
func SafeWriter(w ...io.Writer) *io.PipeWriter
func WithOptions ¶
func WithOptions(options *Options)
Types ¶
type Logger ¶
func NewZLogger ¶ added in v1.0.3
type Option ¶ added in v1.0.3
type Option func(*TimeRotatingWriter)
Option 配置函数
func WithConsole ¶ added in v1.0.3
func WithLinkName ¶ added in v1.0.3
func WithLocation ¶ added in v1.0.3
func WithMaxAge ¶ added in v1.0.3
type Options ¶
type TextHandler ¶ added in v1.0.3
type TimeRotatingWriter ¶ added in v1.0.3
type TimeRotatingWriter struct {
// contains filtered or unexported fields
}
TimeRotatingWriter 按时间轮转的日志写入器
func NewTimeRotatingWriter ¶ added in v1.0.3
func NewTimeRotatingWriter(dir string, opts ...Option) (*TimeRotatingWriter, error)
NewTimeRotatingWriter 创建轮转写入器
func (*TimeRotatingWriter) Close ¶ added in v1.0.3
func (w *TimeRotatingWriter) Close() error
Close 实现 io.Closer
Click to show internal directories.
Click to hide internal directories.