monitor

package
v0.6.3 Latest Latest
Warning

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

Go to latest
Published: Jul 2, 2019 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

View Source
const TokenF = "token"

TokenF is a token field name that will be stripped from logs in production mode

Variables

View Source
var Logger = logrus.New()

Logger is a global instance of logrus object.

Functions

func CaptureException

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

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 SetVersionTag

func SetVersionTag(tag VersionTag)

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("storage", F{"query": "..."}).Info("query error")

type VersionTag

type VersionTag struct {
	LbrytvVersion string
	SDKVersion    string
}

Jump to

Keyboard shortcuts

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