monitor

package
v0.14.4 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 22, 2020 License: MIT Imports: 12 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// TokenF is a token field name that will be stripped from logs in production mode.
	TokenF = "token"
)

Variables

View Source
var IgnoredExceptions = []string{
	responses.AuthRequiredErrorMessage,
}
View Source
var IsProduction = false

Functions

func ConfigureSentry added in v0.14.4

func ConfigureSentry(dsn, release, env string)

func ErrorLoggingMiddleware added in v0.9.1

func ErrorLoggingMiddleware(next http.Handler) http.Handler

ErrorLoggingMiddleware intercepts panics and regular error responses from http handlers, handles them in a graceful way, logs and sends them to Sentry

func ErrorToSentry added in v0.13.6

func ErrorToSentry(err error, params ...map[string]string)

ErrorToSentry sends to Sentry general exception info with some extra provided detail (like user email, claim url etc)

func LogMode added in v0.14.4

func LogMode() string

func LogSuccessfulQuery

func LogSuccessfulQuery(method string, time float64, params interface{}, response interface{})

LogSuccessfulQuery takes a remote method name, execution time and params and logs it

Types

type ModuleLogger

type ModuleLogger struct {
	Entry *logrus.Entry
}

TODO: we could drop the custom struct completely. it doesnt add anything anymore 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) Disable added in v0.9.1

func (m ModuleLogger) Disable()

Disable turns off logging output for this module logger

func (ModuleLogger) Log

func (m 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")

func (ModuleLogger) WithFields added in v0.11.0

func (m ModuleLogger) WithFields(fields logrus.Fields) *logrus.Entry

WithFields returns a new log entry containing additional info provided by fields, which can be called upon with a corresponding logLevel. Example:

logger.WithFields(F{"query": "..."}).Info("query error")

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL