Documentation ¶
Overview ¶
Package log provides logging utilities for tnet.
Index ¶
- func Debug(args ...any)
- func Debugf(format string, args ...any)
- func Error(args ...any)
- func Errorf(format string, args ...any)
- func Fatal(args ...any)
- func Fatalf(format string, args ...any)
- func Info(args ...any)
- func Infof(format string, args ...any)
- func Warn(args ...any)
- func Warnf(format string, args ...any)
- type Logger
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Debug ¶
func Debug(args ...any)
Debug logs to DEBUG log. Arguments are handled in the manner of fmt.Print.
func Error ¶
func Error(args ...any)
Error logs to ERROR log. Arguments are handled in the manner of fmt.Print.
func Fatal ¶
func Fatal(args ...any)
Fatal logs to ERROR log. Arguments are handled in the manner of fmt.Print.
func Info ¶
func Info(args ...any)
Info logs to INFO log. Arguments are handled in the manner of fmt.Print.
Types ¶
type Logger ¶
type Logger interface { // Debug logs to DEBUG log. Arguments are handled in the manner of fmt.Print. Debug(args ...any) // Debugf logs to DEBUG log. Arguments are handled in the manner of fmt.Printf. Debugf(format string, args ...any) // Info logs to INFO log. Arguments are handled in the manner of fmt.Print. Info(args ...any) // Infof logs to INFO log. Arguments are handled in the manner of fmt.Printf. Infof(format string, args ...any) // Warn logs to WARNING log. Arguments are handled in the manner of fmt.Print. Warn(args ...any) // Warnf logs to WARNING log. Arguments are handled in the manner of fmt.Printf. Warnf(format string, args ...any) // Error logs to ERROR log. Arguments are handled in the manner of fmt.Print. Error(args ...any) // Errorf logs to ERROR log. Arguments are handled in the manner of fmt.Printf. Errorf(format string, args ...any) // Fatal logs to ERROR log. Arguments are handled in the manner of fmt.Print. Fatal(args ...any) // Fatalf logs to ERROR log. Arguments are handled in the manner of fmt.Printf. Fatalf(format string, args ...any) }
Logger provides a unified logging interface.
var Default Logger = zap.New( zapcore.NewCore( zapcore.NewConsoleEncoder(encoderConfig), zapcore.AddSync(os.Stdout), zap.NewAtomicLevelAt(zapcore.InfoLevel), ), zap.AddCaller(), zap.AddCallerSkip(1), ).Sugar()
Default borrows logging utilities from zap. The default log level is info level. The default output is standard output. You may replace it with whatever logger you like as long as it implements log.Logger interface.
Click to show internal directories.
Click to hide internal directories.