Documentation ¶
Index ¶
- Variables
- func Debug(msg string, tags ...zapcore.Field)
- func Debugf(format string, a ...any)
- func Error(msg string, tags ...zapcore.Field)
- func Errorf(format string, a ...any)
- func Fatal(msg string, tags ...zapcore.Field)
- func Fatalf(format string, a ...any)
- func GinZap() gin.HandlerFunc
- func Info(msg string, tags ...zapcore.Field)
- func Infof(format string, a ...any)
- func Panic(msg string, tags ...zapcore.Field)
- func Panicf(format string, a ...any)
- func RestyDebugLogger(resp *resty.Response)
- func SetLogger(opts ...Option)
- func SetLoggerWithConfig(config zap.Config)
- func Warn(msg string, tags ...zapcore.Field)
- func Warnf(format string, a ...any)
- type Config
- type Option
Constants ¶
This section is empty.
Variables ¶
var ( LevelInfo = zap.InfoLevel.CapitalString() LevelDebug = zap.DebugLevel.CapitalString() )
Functions ¶
func Debug ¶
Debug logs a message at the zap.DebugLevel. Additional fields can be added to the logger using tags.
func Error ¶
Error logs a message at the zap.ErrorLevel. Additional fields can be added to the logger using tags.
func Fatal ¶
Fatal logs a message at the zap.FatalLevel. Additional fields can be added to the logger using tags.
func GinZap ¶
func GinZap() gin.HandlerFunc
GinZap returns a gin.HandlerFunc (middleware) that logs requests using uber-go/zap. Requests with errors are logged using zap.Error(). Requests without errors are logged using zap.Info().
func Info ¶
Info logs a message at the zap.InfoLevel. Additional fields can be added to the logger using tags.
func Panic ¶
Panic logs a message at the zap.PanicLevel. Additional fields can be added to the logger using tags.
func RestyDebugLogger ¶
func RestyDebugLogger(resp *resty.Response)
RestyDebugLogger prints debug logs for a http request based on the resty.Response.
func SetLogger ¶
func SetLogger(opts ...Option)
SetLogger sets the desired loglevel and re-initializes the logger util.
func SetLoggerWithConfig ¶
SetLoggerWithConfig initializes the logger util with a custom configuration.
Types ¶
type Option ¶
type Option func(config *Config)
func WithLogLevel ¶
WithLogLevel is an option that can be used to define a custom log level Currently only INFO (default) and DEBUG are supported
func WithOutputPaths ¶
WithOutputPaths is an option that can be used to define custom log output paths. Default path is stdout.