log

package
v0.7.0-beta.3 Latest Latest
Warning

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

Go to latest
Published: Sep 13, 2023 License: Apache-2.0 Imports: 4 Imported by: 2

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Debug

func Debug(v ...interface{})

Debug provides verbose logging beyond regular function - wraps Print

func Debugf

func Debugf(format string, v ...interface{})

Debugf provides verbose logging beyond regular function - wraps Printf

func Debugln

func Debugln(v ...interface{})

Debugln provides verbose logging beyond regular function - wraps Println

func Error

func Error(v ...interface{})

Error provides a "normal production" logging level - wraps Print

func Errorf

func Errorf(format string, v ...interface{})

Errorf provides a "normal production" logging level - wraps Printf

func Errorln

func Errorln(v ...interface{})

Errorln provides a "normal production" logging level - wraps Println

func Fatal

func Fatal(v ...interface{})

Fatal is equivalent to Print() followed by a call to os.Exit(1).

func Fatalf

func Fatalf(format string, v ...interface{})

Fatalf is equivalent to Printf() followed by a call to os.Exit(1).

func Fatalln

func Fatalln(v ...interface{})

Fatalln is equivalent to Println() followed by a call to os.Exit(1).

func Flags

func Flags() int

Flags returns the output flags for the standard logger. The flag bits are Ldate, Ltime, and so on.

func Info

func Info(v ...interface{})

Info provides only informational logging that would typically be written to stdout - wraps Print

func Infof

func Infof(format string, v ...interface{})

Infof provides only informational logging that would typically be written to stdout - wraps Printf

func Infoln

func Infoln(v ...interface{})

Infoln provides only informational logging that would typically be written to stdout - wraps Println

func Output

func Output(calldepth int, s string) error

Output writes the output for a logging event. The string s contains the text to print after the prefix specified by the flags of the Logger. A newline is appended if the last character of s is not already a newline. Calldepth is the count of the number of frames to skip when computing the file name and line number if Llongfile or Lshortfile is set; a value of 1 will print the details for the caller of Output.

func Panic

func Panic(v ...interface{})

Panic is equivalent to Print() followed by a call to panic().

func Panicf

func Panicf(format string, v ...interface{})

Panicf is equivalent to Printf() followed by a call to panic().

func Panicln

func Panicln(v ...interface{})

Panicln is equivalent to Println() followed by a call to panic().

func Prefix

func Prefix() string

Prefix returns the output prefix for the standard logger.

func Print

func Print(v ...interface{})

Print calls Output to print to the standard logger. Arguments are handled in the manner of fmt.Print.

func Printf

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

Printf calls Output to print to the standard logger. Arguments are handled in the manner of fmt.Printf.

func Println

func Println(v ...interface{})

Println calls Output to print to the standard logger. Arguments are handled in the manner of fmt.Println.

func SetFlags

func SetFlags(flag int)

SetFlags sets the output flags for the standard logger. The flag bits are Ldate, Ltime, and so on.

func SetLevel

func SetLevel(l Level)

SetLevel Sets the log level for the log package function calls,

func SetOutput

func SetOutput(w io.Writer)

SetOutput sets the output destination for the standard logger.

func SetPrefix

func SetPrefix(prefix string)

SetPrefix sets the output prefix for the standard logger.

func Trace

func Trace(v ...interface{})

Trace provides the most verbose logging - wraps Print

func Tracef

func Tracef(format string, v ...interface{})

Tracef provides the most verbose logging - wraps Printf

func Traceln

func Traceln(v ...interface{})

Traceln provides the most verbose logging - wraps Println

func Warn

func Warn(v ...interface{})

Warn provides slightly more verbose logging - wraps Print

func Warnf

func Warnf(format string, v ...interface{})

Warnf provides slightly more verbose logging - wraps Printf

func Warnln

func Warnln(v ...interface{})

Warnln provides slightly more verbose logging- wraps Println

func Writer

func Writer() io.Writer

Writer returns the output destination for the standard logger.

Types

type Level

type Level int

Level provides a step of level that can be provided to indicate different logging verbosity

const (
	// UnknownLevel indicates and unrecognized logging level
	UnknownLevel Level = -1

	// TraceLevel provides the most verbose logging
	TraceLevel Level = iota

	// DebugLevel provides verbose logging beyond regular function
	DebugLevel

	// WarnLevel provides slightly more verbose logging
	WarnLevel

	// ErrorLevel provides a "normal production" logging level
	ErrorLevel

	// InfoLevel provides only informational logging that would typically be written to stdout
	InfoLevel
)

func ParseLevel

func ParseLevel(levelStr string) (Level, error)

ParseLevel takes a string and returns the equivalent log Level struct.

type Logger

type Logger struct {
	*log.Logger
	// contains filtered or unexported fields
}

Logger wraps the default golang log package Logger struct so that we can still use its functionality and formatting while adding Log Level controls

func New

func New(out io.Writer, prefix string, flag int) *Logger

New returns a new logger struct.

func (*Logger) Debug

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

Debug provides verbose logging beyond regular function - wraps Print

func (*Logger) Debugf

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

Debugf provides verbose logging beyond regular function - wraps Printf

func (*Logger) Debugln

func (l *Logger) Debugln(v ...interface{})

Debugln provides verbose logging beyond regular function - wraps Println

func (*Logger) Error

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

Error provides a "normal production" logging level - wraps Print

func (*Logger) Errorf

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

Errorf provides a "normal production" logging level - wraps Printf

func (*Logger) Errorln

func (l *Logger) Errorln(v ...interface{})

Errorln provides a "normal production" logging level - wraps Println

func (*Logger) Info

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

Info provides only informational logging that would typically be written to stdout - wraps Print

func (*Logger) Infof

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

Infof provides only informational logging that would typically be written to stdout - wraps Printf

func (*Logger) Infoln

func (l *Logger) Infoln(v ...interface{})

Infoln provides only informational logging that would typically be written to stdout - wraps Println

func (*Logger) SetLevel

func (l *Logger) SetLevel(ll Level)

SetLevel Sets the log level for the log package function calls,

func (*Logger) Trace

func (l *Logger) Trace(v ...interface{})

Trace provides the most verbose logging - wraps Print

func (*Logger) Tracef

func (l *Logger) Tracef(format string, v ...interface{})

Tracef provides the most verbose logging - wraps Printf

func (*Logger) Traceln

func (l *Logger) Traceln(v ...interface{})

Traceln provides the most verbose logging - wraps Println

func (*Logger) Warn

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

Warn provides slightly more verbose logging - wraps Print

func (*Logger) Warnf

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

Warnf provides slightly more verbose logging - wraps Printf

func (*Logger) Warnln

func (l *Logger) Warnln(v ...interface{})

Warnln provides slightly more verbose logging- wraps Println

Jump to

Keyboard shortcuts

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