log

package
v1.0.11 Latest Latest
Warning

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

Go to latest
Published: Apr 9, 2021 License: BSD-3-Clause Imports: 6 Imported by: 0

Documentation

Overview

Package log provides methods for writing logs to Alt4 Methods in this package write logs asynchronously unless otherwise specified. You can call the function `Result` after log which will block if the operation is not done. The advised behaviour is to group your logs and defer the Close method which will wait for all operations to finish

Index

Constants

This section is empty.

Variables

View Source
var BuiltInExit func(code int) = func(code int) {
	os.Exit(code)
}

BuiltInExit Internally this function just calls os.Exit. Override for testing(Fatal, Fatalf, Fatalln)

View Source
var BuiltInPanic func(v interface{}) = func(v interface{}) {
	panic(v)
}

BuiltInPanic Internally this function just calls panic(). Override for testing(Panic, Panicf, Panicln)

Functions

func Debug

func Debug(v ...interface{}) *service.LogResult

Debug send a log message to alt4. The log level is DEBUG. Log message will be formatted by fmt.Sprint(a...)

func Debugf

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

Debugf send a log message to alt4. The log level is DEBUG. Log message will be formatted by fmt.Sprintf(a...)

func Debugln

func Debugln(v ...interface{}) *service.LogResult

Debugln send a log message to alt4. The log level is DEBUG. Log message will be formatted by fmt.Sprintln(a...)

func Error

func Error(v ...interface{}) *service.LogResult

Error send a log message to alt4. The log level is ERROR. Log message will be formatted by fmt.Sprint(a...)

func Errorf

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

Errorf send a log message to alt4. The log level is ERROR. Log message will be formatted by fmt.Sprintf(a...)

func Errorln

func Errorln(v ...interface{}) *service.LogResult

Errorln send a log message to alt4. The log level is ERROR. Log message will be formatted by fmt.Sprintln(a...)

func Fatal

func Fatal(v ...interface{})

Fatal This is equivalent to calling Print followed by os.Exit(1). The log level is FATAL. This method will wait for the write to complete

func Fatalf

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

Fatalf This is equivalent to calling Printf followed by os.Exit(1). The log level is FATAL. This method will wait for the write to complete

func Fatalln

func Fatalln(v ...interface{})

Fatalln This is equivalent to calling Println followed by os.Exit(1). The log level is FATAL. This method will wait for the write to complete

func Info

func Info(v ...interface{}) *service.LogResult

Info send a log message to alt4. The log level is INFO. Log message will be formatted by fmt.Sprint(a...)

func Infof

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

Infof send a log message to alt4. The log level is INFO. Log message will be formatted by fmt.Sprintf(a...)

func Infoln

func Infoln(v ...interface{}) *service.LogResult

Infoln send a log message to alt4. The log level is DEBUG. Log message will be formatted by fmt.Sprintln(a...)

func Panic

func Panic(v ...interface{})

Panic This is equivalent to calling Print followed by panic(). The log level is FATAL. This method will wait for the write to complete

func Panicf

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

Panicf This is equivalent to calling Printf followed by panic(). The log level is FATAL. This method will wait for the write to complete

func Panicln

func Panicln(v ...interface{})

Panicln This is equivalent to calling Println followed by panic(). The log level is FATAL. This method will wait for the write to complete

func Print

func Print(v ...interface{}) *service.LogResult

Print send a log message to alt4. The log level is NONE. Log message will be formatted by fmt.Sprint(a...)

func Printf

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

Printf send a log message to alt4. The log level is NONE. Log message will be formatted by fmt.Sprintf(a...)

func Println

func Println(v ...interface{}) *service.LogResult

Println send a log message to alt4. The log level is NONE. Log message will be formatted by fmt.Sprintln(a...)

func Warning

func Warning(v ...interface{}) *service.LogResult

Warning send a log message to alt4. The log level is WARNING. Log message will be formatted by fmt.Sprint(a...)

func Warningf

func Warningf(format string, v ...interface{}) *service.LogResult

Warningf send a log message to alt4. The log level is WARNING. Log message will be formatted by fmt.Sprintf(a...)

func Warningln

func Warningln(v ...interface{}) *service.LogResult

Warningln send a log message to alt4. The log level is WARNING. Log message will be formatted by fmt.Sprintln(a...)

Types

type Claims

type Claims map[string]interface{}

Claims are fields that will can be associated to your log entry. They can be used to filter and better identify your logs.

func (Claims) Debug

func (claims Claims) Debug(v ...interface{}) *service.LogResult

Debug send claims and the log message to alt4. The log level is DEBUG. Log message will be formatted by fmt.Sprint(a...)

func (Claims) Debugf

func (claims Claims) Debugf(format string, v ...interface{}) *service.LogResult

Debugf send claims and the log message to alt4. The log level is DEBUG. Log message will be formatted by fmt.Sprintf(a...)

func (Claims) Debugln

func (claims Claims) Debugln(v ...interface{}) *service.LogResult

Debugln send claims and the log message to alt4. The log level is DEBUG. Log message will be formatted by fmt.Sprintln(a...)

func (Claims) Error

func (claims Claims) Error(v ...interface{}) *service.LogResult

Error send claims and the log message to alt4. The log level is ERROR. Log message will be formatted by fmt.Sprint(a...)

func (Claims) Errorf

func (claims Claims) Errorf(format string, v ...interface{}) *service.LogResult

Errorf send claims and the log message to alt4. The log level is ERROR. Log message will be formatted by fmt.Sprintf(a...)

func (Claims) Errorln

func (claims Claims) Errorln(v ...interface{}) *service.LogResult

Errorln send claims and the log message to alt4. The log level is ERROR. Log message will be formatted by fmt.Sprintln(a...)

func (Claims) Fatal

func (claims Claims) Fatal(v ...interface{})

Fatal This is equivalent to calling Print followed by os.Exit(1). The log level is FATAL. This method will wait for the write to complete

func (Claims) Fatalf

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

Fatalf This is equivalent to calling Printf followed by os.Exit(1). The log level is FATAL. This method will wait for the write to complete

func (Claims) Fatalln

func (claims Claims) Fatalln(v ...interface{})

Fatalln This is equivalent to calling Println followed by os.Exit(1). The log level is FATAL. This method will wait for the write to complete

func (Claims) Group

func (claims Claims) Group(v ...interface{}) *GroupResult

Group start a log group for the goroutine that calls this function. A group should be closed after. Use: `defer Claims{...}.Group(...).Close()`

func (Claims) Info

func (claims Claims) Info(v ...interface{}) *service.LogResult

Info send claims and the log message to alt4. The log level is INFO. Log message will be formatted by fmt.Sprint(a...)

func (Claims) Infof

func (claims Claims) Infof(format string, v ...interface{}) *service.LogResult

Infof send claims and the log message to alt4. The log level is INFO. Log message will be formatted by fmt.Sprintf(a...)

func (Claims) Infoln

func (claims Claims) Infoln(v ...interface{}) *service.LogResult

Infoln send claims and the log message to alt4. The log level is DEBUG. Log message will be formatted by fmt.Sprintln(a...)

func (Claims) Panic

func (claims Claims) Panic(v ...interface{})

Panic This is equivalent to calling Print followed by panic(). The log level is FATAL. This method will wait for the write to complete

func (Claims) Panicf

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

Panicf This is equivalent to calling Printf followed by panic(). The log level is FATAL. This method will wait for the write to complete

func (Claims) Panicln

func (claims Claims) Panicln(v ...interface{})

Panicln This is equivalent to calling Println followed by panic(). The log level is FATAL. This method will wait for the write to complete

func (Claims) Print

func (claims Claims) Print(v ...interface{}) *service.LogResult

Print send claims and the log message to alt4. The log level is NONE. Log message will be formatted by fmt.Sprint(a...)

func (Claims) Printf

func (claims Claims) Printf(format string, v ...interface{}) *service.LogResult

Printf send claims and the log message to alt4. The log level is NONE. Log message will be formatted by fmt.Sprintf(a...)

func (Claims) Println

func (claims Claims) Println(v ...interface{}) *service.LogResult

Println send claims and the log message to alt4. The log level is NONE. Log message will be formatted by fmt.Sprintln(a...)

func (Claims) Warning

func (claims Claims) Warning(v ...interface{}) *service.LogResult

Warning send claims and the log message to alt4. The log level is WARNING. Log message will be formatted by fmt.Sprint(a...)

func (Claims) Warningf

func (claims Claims) Warningf(format string, v ...interface{}) *service.LogResult

Warningf send claims and the log message to alt4. The log level is WARNING. Log message will be formatted by fmt.Sprintf(a...)

func (Claims) Warningln

func (claims Claims) Warningln(v ...interface{}) *service.LogResult

Warningln send claims and the log message to alt4. The log level is WARNING. Log message will be formatted by fmt.Sprintln(a...)

type GroupResult

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

GroupResult Object returned by creating a new log group/thread.

func Group

func Group(v ...interface{}) *GroupResult

Group start a log group for the goroutine that calls this function. A group should be closed after. Use: `defer Group(...).Close()`

func (GroupResult) Close

func (result GroupResult) Close(v ...interface{})

Close will mark the end of a thread closing the log group. If arguments are provided to the close function, they'll be logged. This can be useful for determining the latency of a request. If there were unfinished writes to alt4 during this thread. This method will wait for the writes to finish Close also logs any panic but doesn't recover.

func (GroupResult) Result

func (result GroupResult) Result() (*proto.Result, error)

Return the result of the actual log event

Jump to

Keyboard shortcuts

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