log

package
v42.0.0-...-56f38d9 Latest Latest
Warning

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

Go to latest
Published: Sep 5, 2017 License: Apache-2.0 Imports: 20 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 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 ouput 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 middlware logs the request and response bodies.

func Logger

func Logger() *log.Logger

Logger returns the current logger object.

func NewCustomizedLogger

func NewCustomizedLogger(level string, logJSON bool) (*log.Logger, error)

NewCustomizedLogger creates a custom logger specifying the desired log level and the log format flag. Returns the logger object and the error.

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 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