Documentation ¶
Overview ¶
Package logging provides some helper functions to log with context
Index ¶
- func Critical(ctx context.Context, format string, args ...interface{})
- func Debug(ctx context.Context, format string, args ...interface{})
- func Error(ctx context.Context, format string, args ...interface{})
- func Errorw(ctx context.Context, msg string, keysAndValues ...interface{})
- func Finalize()
- func HTTP(ctx context.Context, req *http.Request, res *http.Response, path string, ...)
- func Info(ctx context.Context, format string, args ...interface{})
- func Infow(ctx context.Context, msg string, keysAndValues ...interface{})
- func Initialize(c *Config) error
- func RequestLogger(excludes []string) gin.HandlerFunc
- func Warn(ctx context.Context, format string, args ...interface{})
- type Config
- type Level
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func HTTP ¶
func HTTP(ctx context.Context, req *http.Request, res *http.Response, path string, latency time.Duration)
HTTP is a helper function for logging API request/response
func RequestLogger ¶
func RequestLogger(excludes []string) gin.HandlerFunc
RequestLogger provides a gin middleware to log HTTP requests
Types ¶
type Config ¶
type Config struct { ProjectID string `json:"project_id" yaml:"project_id"` Level Level `json:"level" yaml:"level"` Development bool `json:"development" yaml:"development"` KeyRequestID string `json:"key_request_id" yaml:"key_request_id"` KeyUserID string `json:"key_user_id" yaml:"key_user_id"` KeyError string `json:"key_error" yaml:"key_error"` KeyScope string `json:"key_scope" yaml:"key_scope"` }
Click to show internal directories.
Click to hide internal directories.