Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func LogForGin ¶
func LogForGin(logger Logger) gin.HandlerFunc
LogForGin returns a gin.HandlerFunc (middleware) that logs requests using Logger.
Requests with errors are logged using log15.Error(). Requests without errors are logged using log15.Info().
func LogPanicData ¶
func LogPanicData(panicData interface{}) error
LogPanicData logs the panic data with stacktrace and return an error with the panic message. This function is separated from LogAndPanic so that unwanted panics can still be logged with this function.
Types ¶
type Logger ¶
type Logger interface { // Panic logs a error level message then panics Panic(msg string, ctx ...interface{}) // Error logs an error level message Error(msg string, ctx ...interface{}) // Warn logs a warning level message Warn(msg string, ctx ...interface{}) // Info logs an information level message Info(msg string, ctx ...interface{}) // Debug logs a debug level message. This may be very verbose Debug(msg string, ctx ...interface{}) // New returns a child logger with the given context New(ctx ...interface{}) Logger // Sync the logger cache Sync() error }
A Logger writes logs to a handler
Click to show internal directories.
Click to hide internal directories.