clog

package
v0.11.1 Latest Latest
Warning

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

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

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Errorf

func Errorf(format string, a ...interface{}) error

Errorf formats and returns error and logs at level 2

func InitNoFlag

func InitNoFlag(out io.Writer, level Level)

InitNoFlag initializes without CLI flag which means the level must be initialized useful for tests

func InitWithFlags added in v0.8.0

func InitWithFlags(f *pflag.FlagSet, out io.Writer)

InitWithFlags allows for the initialization of log via root command

func Printf

func Printf(format string, args ...interface{})

Printf provides default level printing for things that will always print

Types

type Level

type Level int8

Level specifies a level of verbosity for V logs.

func (*Level) Get

func (l *Level) Get() interface{}

Get is required for https://godoc.org/flag#Getter the return of interface{} is forced by Getter interface

func (*Level) Set

func (l *Level) Set(value string) error

Set is part of the flag.Value interface.

func (*Level) String

func (l *Level) String() string

String is part of the flag.Value interface.

func (*Level) Type

func (l *Level) Type() string

Type is part of flag.Value interface

type Verbose

type Verbose bool

Verbose is boolean type that implements Println, Printf See glog and documentation for V

func V

func V(level Level) Verbose

V reports true if the verbosity at the call site is at least the request level. This the following glog style code samples are possible:

if clog.V(2) { clog.Print("log this") }

or

clog.V(2).Print("log this")

Whether the call site logs is determined by the `-v` flags.

func (Verbose) Printf

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

Printf is equivalent to the global Printf function, guarded by the value of v. See the documentation of V for usage.

Jump to

Keyboard shortcuts

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