log

package
v0.19.2 Latest Latest
Warning

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

Go to latest
Published: Apr 5, 2024 License: Apache-2.0 Imports: 6 Imported by: 1

Documentation

Overview

Package log has logging interfaces for convenience in lifecycle

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewMeasurement added in v0.17.0

func NewMeasurement(funcName string, lager Logger) func()

NewMeasurement initializes a chronological measuring tool, logs out the start time, and returns a function you can defer that will log the end time

Types

type Chronit added in v0.17.0

type Chronit struct {
	StartTime    time.Time
	EndTime      time.Time
	Log          Logger
	FunctionName string
}

Chronit is, I guess, short for chronological unit because it measures time or something

func (*Chronit) RecordEnd added in v0.17.0

func (c *Chronit) RecordEnd()

RecordEnd is called in the function returned by NewMeasurement. the EndTime will be populated just in case you'll keep the object in scope for later.

func (*Chronit) RecordStart added in v0.17.0

func (c *Chronit) RecordStart()

RecordStart grabs the current time and logs it, but it will be called for you if you use the NewMeasurement convenience function.

type DefaultLogger added in v0.16.0

type DefaultLogger struct {
	*log.Logger
}

DefaultLogger extends `github.com/apex/log` `log.Logger`

func NewDefaultLogger added in v0.16.0

func NewDefaultLogger(writer io.Writer) *DefaultLogger

func (*DefaultLogger) HandleLog added in v0.16.0

func (l *DefaultLogger) HandleLog(entry *log.Entry) error

func (*DefaultLogger) LogLevel added in v0.16.0

func (l *DefaultLogger) LogLevel() log.Level

func (*DefaultLogger) Phase added in v0.16.0

func (l *DefaultLogger) Phase(name string)

func (*DefaultLogger) SetLevel added in v0.16.0

func (l *DefaultLogger) SetLevel(requested string) error

type Logger

type Logger interface {
	Debug(msg string)
	Debugf(fmt string, v ...interface{})

	Info(msg string)
	Infof(fmt string, v ...interface{})

	Warn(msg string)
	Warnf(fmt string, v ...interface{})

	Error(msg string)
	Errorf(fmt string, v ...interface{})
}

type LoggerHandlerWithLevel added in v0.16.0

type LoggerHandlerWithLevel interface {
	Logger
	HandleLog(entry *log.Entry) error
	LogLevel() log.Level
}

Jump to

Keyboard shortcuts

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