flog

package
v0.4.10 Latest Latest
Warning

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

Go to latest
Published: Nov 27, 2022 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Overview

Package flog is a simple wrapper around Golang's log package which adds verbosity support.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Logger

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

A Logger represents an active logging instance that generates lines of output to an io.Writer. Each logging operation makes a single call to the Writer's Encode method. A Logger can be used simultaneously from multiple goroutines; it guarantees to serialize access to the Writer.

func New

func New(logger *log.Logger) *Logger

New returns a new Logger

func (*Logger) SetLevel

func (f *Logger) SetLevel(level int32)

SetLevel sets verbosity level.

func (*Logger) ShowLineNumber

func (f *Logger) ShowLineNumber(show int32)

ShowLineNumber enables line number support if show is bigger than zero.

func (*Logger) V

func (f *Logger) V(level int32) Verbose

V reports whether verbosity at the call site is at least the requested level. The returned value is a struct of type Verbose, which implements Printf and Println

type Verbose

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

Verbose is a type that implements Printf and Println with verbosity support.

func (Verbose) Ok

func (v Verbose) Ok() bool

Ok will return true if this log level is enabled, guarded by the value of verbosity level.

func (Verbose) Printf

func (v Verbose) Printf(format string, i ...interface{})

Printf calls v.f.logger.Printf to print to the logger. Arguments are handled in the manner of fmt.Printf.

func (Verbose) Println

func (v Verbose) Println(i ...interface{})

Println calls v.f.logger.Println to print to the logger. Arguments are handled in the manner of fmt.Println.

Jump to

Keyboard shortcuts

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