monitor

package
v0.5.1 Latest Latest
Warning

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

Go to latest
Published: May 7, 2019 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var Logger = logrus.New()

Logger is a global instance of logrus object.

Functions

func LogCachedQuery

func LogCachedQuery(method string)

LogCachedQuery logs a cache hit for a given method

func LogFailedQuery

func LogFailedQuery(method string, query interface{}, error interface{})

LogFailedQuery takes a method name, query params, response error object and logs it

func LogSuccessfulQuery

func LogSuccessfulQuery(method string, time float64)

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

func RequestLoggingMiddleware

func RequestLoggingMiddleware(next http.Handler) http.Handler

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

type ModuleLogger struct {
	ModuleName string
	Logger     *logrus.Logger
}

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")

func (ModuleLogger) LogF

func (l ModuleLogger) LogF(fields F) *logrus.Entry

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

LogF("db", F{"query": "..."}).Info("query error")

Jump to

Keyboard shortcuts

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