Documentation
¶
Index ¶
- type Logger
- type LoggerMaker
- type NopLogger
- func (n *NopLogger) Extend(string) Logger
- func (n *NopLogger) NewLogger(string) Logger
- func (n *NopLogger) Recovery() gin.HandlerFunc
- func (n *NopLogger) RecoveryWith(handler gin.HandlerFunc) gin.HandlerFunc
- func (n *NopLogger) WithGin(*gin.Context) Logger
- func (n *NopLogger) WithUser(string) Logger
- type SentryConfig
- type SentryManager
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Logger ¶
type Logger interface {
logrus.Ext1FieldLogger
// Extend returns a Logger with an extended name path.
Extend(name string) Logger
// WithUser includes the given user id in the logger context.
WithUser(userID string) Logger
// WithGin includes the given gin request context in the logger context.
WithGin(c *gin.Context) Logger
// Recovery returns a gin handler function that will recover and log panics.
Recovery() gin.HandlerFunc
// RecoveryWith returns a gin handler function that will recover with a specific behavior
// while also logging panics.
RecoveryWith(handler gin.HandlerFunc) gin.HandlerFunc
}
Logger extends a logrus logger by providing path-like names.
type LoggerMaker ¶
type NopLogger ¶ added in v1.2.0
NopLogger is a logger which does nothing.
func NewNopLogger ¶ added in v1.2.0
func NewNopLogger() *NopLogger
NewNopLogger creates a new NopLogger instance.
func (*NopLogger) Recovery ¶ added in v1.2.0
func (n *NopLogger) Recovery() gin.HandlerFunc
func (*NopLogger) RecoveryWith ¶ added in v1.2.2
func (n *NopLogger) RecoveryWith(handler gin.HandlerFunc) gin.HandlerFunc
type SentryConfig ¶
type SentryManager ¶
type SentryManager struct {
// contains filtered or unexported fields
}
SentryManager is a struct that issues loggers tied back to a central sentry.Hub instance.
func NewSentryManager ¶
func NewSentryManager(config *SentryConfig, logLevel string) (*SentryManager, error)
NewSentryManager creates a SentryManager with a logLevel output minimum.
func (*SentryManager) Fire ¶
func (m *SentryManager) Fire(lEntry *logrus.Entry) error
Fire implements the logrus.Hook interface. Log entries will be logged to Sentry.
func (*SentryManager) Levels ¶
func (m *SentryManager) Levels() []logrus.Level
Levels implements the logrus.Hook interface.
func (*SentryManager) NewLogger ¶
func (m *SentryManager) NewLogger(name string) Logger
NewLogger returns a Logger with the given name, linked to this SentryManager object
func (*SentryManager) WithRequestContext ¶
func (m *SentryManager) WithRequestContext(ctx *gin.Context)
WithRequestContext issues a new sentry.Hub and sets the Hub's current request to req. To be used in gin.Use as middleware.