Documentation ¶
Overview ¶
Package log provides an implementation of our own logging API calls atop of logrus logging package
Index ¶
- func Debug(ctx context.Context, fields map[string]interface{}, format string, ...)
- func Error(ctx context.Context, fields map[string]interface{}, format string, ...)
- func ExtractRequestID(ctx context.Context) string
- func Info(ctx context.Context, fields map[string]interface{}, format string, ...)
- func InitializeLogger(logJSON bool, lvl string)
- func IsDebug() bool
- func LogRequest(verbose bool) goa.Middleware
- func Logger() *log.Logger
- func Panic(ctx context.Context, fields map[string]interface{}, format string, ...)
- func PointerToString(str *string) string
- func Warn(ctx context.Context, fields map[string]interface{}, format string, ...)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Debug ¶
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 ¶
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 ¶
ExtractRequestID obtains the request ID either from a goa client or middleware
func Info ¶
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 ¶
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 Panic ¶
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 ¶
PointerToString return a string pointer value or "<nil>" if the pointer == nil
func Warn ¶
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.