log

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: May 20, 2020 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Debug

func Debug(infoMessage string, args ...interface{})

func EnableDebugMode

func EnableDebugMode()

func Error

func Error(errorMessage string, args ...interface{})

func Info

func Info(infoMessage string, args ...interface{})

func RecordedError

func RecordedError(errorMessage string, args ...interface{}) error

Prints an error message to the error log and returns a new error with the given message. This method can receive also more arguments (e.g an external error) and they will be appended to the given error message.

For example, we have a local method `someMethod()`. This method handles its own error printing and thus we can consume the error and not append it to the new error message, as follows:

returnVal, err := someMethod()
if err != nil {
	return nil, log.RecordedError("failed to run someMethod")
}

On the other hand, if `someMethod()` is a 3rd party method we want to print also the returned error as it wasn't printed to the error log. So we'll have the following code:

returnVal, err := 3rdParty.someMethod()
if err != nil {
	return nil, log.RecordedError(fmt.Sprintf("failed to run someMethod. Reason: %s", err))
}

func Warn

func Warn(infoMessage string, args ...interface{})

Types

This section is empty.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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