logging

package
v0.0.0-...-14ef7bc Latest Latest
Warning

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

Go to latest
Published: Nov 21, 2024 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var DEBUG = 1
View Source
var ERROR = 4
View Source
var FATAL = 5
View Source
var INFO = 2
View Source
var Logger = logger{}
View Source
var TRACE int = 0
View Source
var WARNING = 3

Functions

func LogMeasurement

func LogMeasurement(metric string, params map[string]string, elapsed time.Duration, result string, err error)

Store given measurement

func Measure

func Measure(fn interface{}, params ...interface{}) (interface{}, error)

Measure duration of a given function run with given parameters and return what function returned This only returns first (data) and last (error) returned value. Maybe this can be generalized completely, but it is good enough for our needs.

func MeasurementsStart

func MeasurementsStart(directory string)

Initialize channels and start functions that are processing records

func MeasurementsStop

func MeasurementsStop()

Close channels and wait to ensure any remaining records are written to CSV

Types

type ErrorEntry

type ErrorEntry struct {
	Timestamp time.Time
	Code      int
	Message   string
}

Represents the data about failure we want to store to CSV

func (*ErrorEntry) GetSliceOfStrings

func (e *ErrorEntry) GetSliceOfStrings() []string

Helper function to convert struct to slice of string which is needed when converting to CSV

type MeasurementEntry

type MeasurementEntry struct {
	Timestamp  time.Time
	Metric     string
	Duration   time.Duration
	Parameters string
	Error      error
}

Represents the data about measurement we want to store to CSV

func (*MeasurementEntry) GetSliceOfStrings

func (e *MeasurementEntry) GetSliceOfStrings() []string

Helper function to convert struct to slice of string which is needed when converting to CSV

Jump to

Keyboard shortcuts

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