logger

package
v0.0.0-...-465781a Latest Latest
Warning

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

Go to latest
Published: Nov 2, 2020 License: MIT Imports: 7 Imported by: 0

Documentation

Overview

Package logger handles application logging

Index

Constants

View Source
const (
	// TraceLevel represents the TRACE logging level
	TraceLevel = "trace"
	// DebugLevel represents the DEBUG logging level
	DebugLevel = "debug"
	// InfoLevel represents the INFO logging level
	InfoLevel = "info"
	// WarnLevel represents the WARN logging level
	WarnLevel = "warn"
	// ErrorLevel represents the ERROR logging level
	ErrorLevel = "error"
	// FatalLevel represents the FATAL logging level
	FatalLevel = "fatal"
	// PanicLevel represents the PANIC logging level
	PanicLevel = "panic"

	// JSONFormat represents the JSON logging format
	JSONFormat = "json"
	// TextFormat represents the text logging format
	TextFormat = "text"
	// ECSFormat represents the Elasticstack Common Schema (ECS) JSON logging format
	ECSFormat = "elastic"
)

Variables

This section is empty.

Functions

func ErrorfAsError

func ErrorfAsError(log logrus.FieldLogger, format string, args ...interface{}) error

ErrorfAsError logs an Error message to the supplied logger and then returns a new error object initialized with the message. The message is formatted with fmt.Sprintf() before passing to the logger and the error object.

func Log

func Log(args ...interface{}) logrus.FieldLogger

Log returns a logrus FieldLogger including the root fields and an optional context

func NewElasticHook

func NewElasticHook() logrus.Hook

func Root

func Root() *logrus.Logger

Root returns the singleton application logger

func SanitizedURLString

func SanitizedURLString(urlWithCreds string) string

SanitizedURLString returns a parsed URL string with user credentials removed

func SetFormat

func SetFormat(format string)

SetFormat configures the logger message format

func SetLevel

func SetLevel(level string)

SetLevel configures the logger logging level

Types

This section is empty.

Jump to

Keyboard shortcuts

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