logging

package
v0.1.7 Latest Latest
Warning

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

Go to latest
Published: Jun 22, 2020 License: Apache-2.0 Imports: 10 Imported by: 8

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Initialize

func Initialize()

Initialize starts the base logger used by all Hexya components

func LogForGin

func LogForGin(logger Logger) gin.HandlerFunc

LogForGin returns a gin.HandlerFunc (middleware) that logs requests using Logger.

Requests with errors are logged using log15.Error(). Requests without errors are logged using log15.Info().

func LogPanicData

func LogPanicData(panicData interface{}) error

LogPanicData logs the panic data with stacktrace and return an error with the panic message. This function is separated from LogAndPanic so that unwanted panics can still be logged with this function.

Types

type Logger

type Logger interface {
	// Panic logs a error level message then panics
	Panic(msg string, ctx ...interface{})
	// Error logs an error level message
	Error(msg string, ctx ...interface{})
	// Warn logs a warning level message
	Warn(msg string, ctx ...interface{})
	// Info logs an information level message
	Info(msg string, ctx ...interface{})
	// Debug logs a debug level message. This may be very verbose
	Debug(msg string, ctx ...interface{})
	// New returns a child logger with the given context
	New(ctx ...interface{}) Logger
	// Sync the logger cache
	Sync() error
}

A Logger writes logs to a handler

func GetLogger

func GetLogger(moduleName string) Logger

GetLogger returns a context logger for the given module

Jump to

Keyboard shortcuts

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