klog

package
v0.0.0-...-9649b88 Latest Latest
Warning

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

Go to latest
Published: Sep 16, 2020 License: Apache-2.0 Imports: 16 Imported by: 62

Documentation

Index

Constants

View Source
const (
	VerDev = iota
	VerRelease
)
View Source
const PluginProgramName = "knitter"

Variables

View Source
var MaxSize uint64 = 1024 * 1024 * 1800

MaxSize is the maximum size of a log file in bytes.

View Source
var Stats struct {
	Trace, Debug, Info, Warning, Error OutputStats
}

Stats tracks the number of lines of output and number of bytes per severity level. Values must be read with atomic.LoadInt64.

Functions

func ConfigLog

func ConfigLog(logpath string)

func CopyStandardLogTo

func CopyStandardLogTo(name string)

CopyStandardLogTo arranges for messages written to the Go "log" package's default logs to also appear in the Google logs for the named and lower severities. Subsequent changes to the standard log's default output location or format may break this behavior.

Valid names are "INFO", "WARNING", "ERROR", and "FATAL". If the name is not recognized, CopyStandardLogTo panics.

func Create

func Create(t time.Time) (f *os.File, filename string, err error)

create creates a new log file and returns the file and its filename, which contains tag ("INFO", "FATAL", etc.) and t. If the file is created successfully, create also attempts to update the symlink for that tag, ignoring errors.

func Debug

func Debug(args ...interface{})

Debug logs to the Debug log. Arguments are handled in the manner of fmt.Print; a newline is appended if missing.

func DebugDepth

func DebugDepth(depth int, args ...interface{})

DebugDepth acts as Debug but uses depth to determine which call frame to log. DebugDepth(0, "msg") is the same as Debug("msg").

func Debugf

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

Debugf logs to the Debug log. Arguments are handled in the manner of fmt.Printf; a newline is appended if missing.

func Debugln

func Debugln(args ...interface{})

Debugln logs to the Debug log. Arguments are handled in the manner of fmt.Println; a newline is appended if missing.

func Error

func Error(args ...interface{})

Error logs to the ERROR, WARNING, and INFO logs. Arguments are handled in the manner of fmt.Print; a newline is appended if missing.

func ErrorDepth

func ErrorDepth(depth int, args ...interface{})

ErrorDepth acts as Error but uses depth to determine which call frame to log. ErrorDepth(0, "msg") is the same as Error("msg").

func Errorf

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

Errorf logs to the ERROR, WARNING, and INFO logs. Arguments are handled in the manner of fmt.Printf; a newline is appended if missing.

func Errorln

func Errorln(args ...interface{})

Errorln logs to the ERROR, WARNING, and INFO logs. Arguments are handled in the manner of fmt.Println; a newline is appended if missing.

func Exit

func Exit(args ...interface{})

Exit logs to the FATAL, ERROR, WARNING, and INFO logs, then calls os.Exit(1). Arguments are handled in the manner of fmt.Print; a newline is appended if missing.

func ExitDepth

func ExitDepth(depth int, args ...interface{})

ExitDepth acts as Exit but uses depth to determine which call frame to log. ExitDepth(0, "msg") is the same as Exit("msg").

func Exitf

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

Exitf logs to the FATAL, ERROR, WARNING, and INFO logs, then calls os.Exit(1). Arguments are handled in the manner of fmt.Printf; a newline is appended if missing.

func Exitln

func Exitln(args ...interface{})

Exitln logs to the FATAL, ERROR, WARNING, and INFO logs, then calls os.Exit(1).

func Fatal

func Fatal(args ...interface{})

Fatal logs to the FATAL, ERROR, WARNING, and INFO logs, including a stack trace of all running goroutines, then calls os.Exit(255). Arguments are handled in the manner of fmt.Print; a newline is appended if missing.

func FatalDepth

func FatalDepth(depth int, args ...interface{})

FatalDepth acts as Fatal but uses depth to determine which call frame to log. FatalDepth(0, "msg") is the same as Fatal("msg").

func Fatalf

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

Fatalf logs to the FATAL, ERROR, WARNING, and INFO logs, including a stack trace of all running goroutines, then calls os.Exit(255). Arguments are handled in the manner of fmt.Printf; a newline is appended if missing.

func Fatalln

func Fatalln(args ...interface{})

Fatalln logs to the FATAL, ERROR, WARNING, and INFO logs, including a stack trace of all running goroutines, then calls os.Exit(255). Arguments are handled in the manner of fmt.Println; a newline is appended if missing.

func Flush

func Flush()

Flush flushes all pending log I/O.

func GetTransActionID

func GetTransActionID() string

func Info

func Info(args ...interface{})

Info logs to the INFO log. Arguments are handled in the manner of fmt.Print; a newline is appended if missing.

func InfoDepth

func InfoDepth(depth int, args ...interface{})

InfoDepth acts as Info but uses depth to determine which call frame to log. InfoDepth(0, "msg") is the same as Info("msg").

func Infof

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

Infof logs to the INFO log. Arguments are handled in the manner of fmt.Printf; a newline is appended if missing.

func Infoln

func Infoln(args ...interface{})

Infoln logs to the INFO log. Arguments are handled in the manner of fmt.Println; a newline is appended if missing.

func SetLogLevel

func SetLogLevel(l Level)

function to set log level

func SetVersionType

func SetVersionType(t int)

func Trace

func Trace(args ...interface{})

Trace logs to the Trace log. Arguments are handled in the manner of fmt.Print; a newline is appended if missing.

func TraceDepth

func TraceDepth(depth int, args ...interface{})

TraceDepth acts as Trace but uses depth to determine which call frame to log. TraceDepth(0, "msg") is the same as Trace("msg").

func Tracef

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

Tracef logs to the Trace log. Arguments are handled in the manner of fmt.Printf; a newline is appended if missing.

func Traceln

func Traceln(args ...interface{})

Traceln logs to the Trace log. Arguments are handled in the manner of fmt.Println; a newline is appended if missing.

func Warning

func Warning(args ...interface{})

Warning logs to the WARNING and INFO logs. Arguments are handled in the manner of fmt.Print; a newline is appended if missing.

func WarningDepth

func WarningDepth(depth int, args ...interface{})

WarningDepth acts as Warning but uses depth to determine which call frame to log. WarningDepth(0, "msg") is the same as Warning("msg").

func Warningf

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

Warningf logs to the WARNING and INFO logs. Arguments are handled in the manner of fmt.Printf; a newline is appended if missing.

func Warningln

func Warningln(args ...interface{})

Warningln logs to the WARNING and INFO logs. Arguments are handled in the manner of fmt.Println; a newline is appended if missing.

Types

type Level

type Level int32

Level specifies a level of level for V logs. *Level implements flag.Value; the -v flag is of type Level and should be modified only through the flag.Value interface.

const (
	TraceLevel Level = iota
	DebugLevel
	InfoLevel
	WarningLevel
	ErrorLevel
	FatalLevel
	NumLevel
)

func GetLogLevel

func GetLogLevel() Level

function to get log level

func (*Level) Get

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

Get is part of the flag.Value 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.

type OutputStats

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

OutputStats tracks the number of output lines and bytes written.

func (*OutputStats) Bytes

func (s *OutputStats) Bytes() int64

Bytes returns the number of bytes written.

func (*OutputStats) Lines

func (s *OutputStats) Lines() int64

Lines returns the number of lines written.

Jump to

Keyboard shortcuts

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