log

package
v0.0.0-...-e32cd3b Latest Latest
Warning

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

Go to latest
Published: Mar 4, 2020 License: Apache-2.0 Imports: 5 Imported by: 38

Documentation

Overview

Package log provides a utility to log timestamped messages to an io.Writer.

Index

Constants

View Source
const (
	Always = iota
	Info
	DebugLow
	DebugHigh
)

Tool Logger verbosity constants

View Source
const (
	ToolTimeFormat = "2006-01-02T15:04:05.000-0700"
)

Variables

This section is empty.

Functions

func IsInVerbosity

func IsInVerbosity(minVerb int) bool

IsInVerbosity returns true if the current verbosity level setting is greater than or equal to the given level.

func Logv

func Logv(minVerb int, msg string)

func Logvf

func Logvf(minVerb int, format string, a ...interface{})

func SetDateFormat

func SetDateFormat(dateFormat string)

func SetVerbosity

func SetVerbosity(verbosity VerbosityLevel)

func SetWriter

func SetWriter(writer io.Writer)

func Writer

func Writer(minVerb int) io.Writer

Types

type ToolLogger

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

func NewToolLogger

func NewToolLogger(verbosity VerbosityLevel) *ToolLogger

func (*ToolLogger) Logv

func (tl *ToolLogger) Logv(minVerb int, msg string)

func (*ToolLogger) Logvf

func (tl *ToolLogger) Logvf(minVerb int, format string, a ...interface{})

func (*ToolLogger) SetDateFormat

func (tl *ToolLogger) SetDateFormat(dateFormat string)

func (*ToolLogger) SetVerbosity

func (tl *ToolLogger) SetVerbosity(level VerbosityLevel)

func (*ToolLogger) SetWriter

func (tl *ToolLogger) SetWriter(writer io.Writer)

func (*ToolLogger) Writer

func (tl *ToolLogger) Writer(minVerb int) io.Writer

Writer returns an io.Writer that writes to the logger with the given verbosity

type VerbosityLevel

type VerbosityLevel interface {
	Level() int
	IsQuiet() bool
}

Jump to

Keyboard shortcuts

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