log

package
v0.0.0-...-2d73068 Latest Latest
Warning

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

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

Documentation

Overview

Package log provides an implementation of our own logging API calls atop of logrus logging package

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Debug

func Debug(ctx context.Context, fields map[string]interface{}, format string, args ...interface{})

Debug logs a debug message that might specifies the request id if provided by the context. In this function, the parameter fields enables to additional attributes to the message. The format and args input arguments are used to print a detailed information about the reasons of this log.

func Error

func Error(ctx context.Context, fields map[string]interface{}, format string, args ...interface{})

Error logs an error message that might contain the following attributes: pid, request id if provided by the context, file location of the caller, line that called the log Error function and the function name. Moreover, we can use the parameter fields to add additional attributes to the output message. Likewise format and args are used to print a detailed message with the reasons of the error log.

func ExtractRequestID

func ExtractRequestID(ctx context.Context) string

ExtractRequestID obtains the request ID either from a goa client or middleware

func Info

func Info(ctx context.Context, fields map[string]interface{}, format string, args ...interface{})

Info logs an info message that might contain the request id if provided by the context. In this function, the parameter fields enables to additional attributes to the message. The format and args input arguments are used to print a detailed information about the reasons of this log.

func InitializeLogger

func InitializeLogger(logJSON bool, lvl string)

InitializeLogger creates a default logger with the given output format and log level

func IsDebug

func IsDebug() bool

IsDebug returns true if logger is set at DebugLevel. Useful if you need to do extra work that takes time to build the log statement that is not required as part of normal execution flow

func LogRequest

func LogRequest(verbose bool) goa.Middleware

LogRequest creates a request logger for the goa middleware. This goa middleware is aware of the RequestID middleware and identity id if registered after it leverages the request and identity ID for logging. If verbose is true then the middleware logs the request and response bodies.

func Logger

func Logger() *log.Logger

Logger returns the current logger object.

func Panic

func Panic(ctx context.Context, fields map[string]interface{}, format string, args ...interface{})

Panic logs a panic message that might contain the following attributes: the request id if provided by the context and the pid. In this function, the parameter fields enables to additional attributes to the message. The format and args input arguments are used to print a detailed information about the reasons of this log.

func PointerToString

func PointerToString(str *string) string

PointerToString return a string pointer value or "<nil>" if the pointer == nil

func Warn

func Warn(ctx context.Context, fields map[string]interface{}, format string, args ...interface{})

Warn logs a warning message that might contain the following attributes: request id if provided by the context, the file and the function name that invoked the Warn() function. In this function, we can use the parameter fields to add additional attributes to the output of this message. Likewise format and args are used to print a detailed message with the reasons of the warning log.

Types

This section is empty.

Jump to

Keyboard shortcuts

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