log

package
v0.18.15 Latest Latest
Warning

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

Go to latest
Published: May 17, 2022 License: Apache-2.0 Imports: 7 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package log provides a logger

Index

Constants

View Source
const (
	FormatStruct = " %#v %s \n"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Level

type Level int
const (
	Fatal Level = iota
	Error
	Warning
	Info
	Debug
	Detail
)

func (Level) String

func (l Level) String() string

type Logger

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

func NewDefaultLogger

func NewDefaultLogger(w io.Writer) *Logger

func NewLoggerWithLevel added in v0.13.0

func NewLoggerWithLevel(w io.Writer, level Level) *Logger

func NewLoggerWithOpts

func NewLoggerWithOpts(w io.Writer, opts Options) *Logger

func NewLoggerWithPrefix

func NewLoggerWithPrefix(w io.Writer, prefix string) *Logger

NewLoggerWithPrefix returns a brand new Logger with the prefix attached

func (*Logger) Debug

func (l *Logger) Debug(args ...interface{})

func (*Logger) Debugf

func (l *Logger) Debugf(format string, args ...interface{})

func (*Logger) Detail added in v0.13.0

func (l *Logger) Detail(args ...interface{})

func (*Logger) Detailf added in v0.13.0

func (l *Logger) Detailf(format string, args ...interface{})

func (*Logger) Dump

func (l *Logger) Dump(msg string, args ...interface{})

Dump calls Debug on msg and pretty prints the types passed to args

func (*Logger) Error

func (l *Logger) Error(args ...interface{})

func (*Logger) Errorf

func (l *Logger) Errorf(format string, args ...interface{})

func (*Logger) Fatal

func (l *Logger) Fatal(args ...interface{})

func (*Logger) Fatalf

func (l *Logger) Fatalf(format string, args ...interface{})

func (*Logger) Info

func (l *Logger) Info(args ...interface{})

func (*Logger) Infof

func (l *Logger) Infof(format string, args ...interface{})

func (*Logger) Warn

func (l *Logger) Warn(args ...interface{})

func (*Logger) Warnf

func (l *Logger) Warnf(format string, args ...interface{})

func (*Logger) WithLevel added in v0.13.0

func (l *Logger) WithLevel(level Level) *Logger

func (Logger) WithPrefix

func (l Logger) WithPrefix(prefix string) *Logger

WithPrefix returns a new logger with the prefix appended to the current logger's prefix

type Options

type Options struct {
	// Set of levels to log
	Prefix string
	// Setting sync to true wraps the
	Sync bool
	// Defines a filter for each log filter
	Level Level
	// Include timestamp?
	IncludeTimestamp bool
}

func DefaultOptions

func DefaultOptions() Options

Jump to

Keyboard shortcuts

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