trace

package
v0.0.0-...-93ef53b Latest Latest
Warning

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

Go to latest
Published: Mar 5, 2024 License: MPL-2.0 Imports: 5 Imported by: 0

Documentation

Overview

Package trace provides simple interfaces for timing applications

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Enabled

func Enabled(e bool)

func Enter

func Enter()

func Exit

func Exit()

func GetTag

func GetTag() string

func IsEnabled

func IsEnabled() bool

func SetLogger

func SetLogger(l Logger)

func SetTag

func SetTag(t string)

Types

type HCLog

type HCLog struct {
	// contains filtered or unexported fields
}

HCLog is a Logger that uses the go-hclog log package to output timer information.

func NewHCLog

func NewHCLog(logger hclog.Logger, level hclog.Level) HCLog

func (HCLog) Print

func (l HCLog) Print(args ...interface{})

Print writes timer information using the logger's Log function, with the configured level.

type Logger

type Logger interface {
	Print(args ...interface{})
}

func GetLogger

func GetLogger() Logger

type Timer

type Timer struct {
	Tag string
	Log Logger
	// contains filtered or unexported fields
}

func Start

func Start(name string) *Timer

Start a timer with the specified name.

func (*Timer) Since

func (t *Timer) Since(args ...interface{})

Since logs the time since the timer started. If present the optional args will be appended to the message.

Jump to

Keyboard shortcuts

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