Documentation ¶
Index ¶
- Constants
- Variables
- func CaptureException(err error, params ...map[string]string)
- func LogCachedQuery(method string)
- func LogFailedQuery(method string, query interface{}, errorResponse interface{})
- func LogSuccessfulQuery(method string, time float64)
- func RequestLoggingMiddleware(next http.Handler) http.Handler
- func SetupLogging()
- type F
- type ModuleLogger
Constants ¶
const TokenF = "token"
TokenF is a token field name that will be stripped from logs in production mode
Variables ¶
var Logger = logrus.New()
Logger is a global instance of logrus object.
Functions ¶
func CaptureException ¶
CaptureException sends to Sentry general exception info with some extra provided detail (like user email, claim url etc)
func LogCachedQuery ¶
func LogCachedQuery(method string)
LogCachedQuery logs a cache hit for a given method
func LogFailedQuery ¶
func LogFailedQuery(method string, query interface{}, errorResponse interface{})
LogFailedQuery takes a method name, query params, response error object and logs it
func LogSuccessfulQuery ¶
LogSuccessfulQuery takes a remote method name and execution time and logs it
func SetupLogging ¶
func SetupLogging()
SetupLogging initializes and sets a few parameters for the logging subsystem.
Types ¶
type F ¶
type F map[string]interface{}
F can be supplied to ModuleLogger's Log function for providing additional log context.
type ModuleLogger ¶
ModuleLogger contains module-specific logger details.
func NewModuleLogger ¶
func NewModuleLogger(moduleName string) ModuleLogger
NewModuleLogger creates a new ModuleLogger instance carrying module name for later `Log()` calls.
func (ModuleLogger) Log ¶
func (l ModuleLogger) Log() *logrus.Entry
Log returns a new log entry for the module which can be called upon with a corresponding logLevel. Example:
Log().Info("query error")