logging

package
v0.0.1 Latest Latest
Warning

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

Go to latest
Published: Dec 21, 2022 License: GPL-2.0 Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var Log *log.Entry

Log is the global log entry; preconfigured based on lambda configuration options

Functions

func AddField

func AddField(key string, val interface{}) *log.Entry

AddField allows adding a structured field and value to the global log entry; it does not add the field to the global entry itself but instead returns a new Entry with the field added

func AddFields

func AddFields(fields log.Fields) *log.Entry

AddFields allows for the adding of multiple structure fields to the global log.Entry

func GetLogForCategory

func GetLogForCategory(cat LogCategory) *log.Entry

GetLogForCategory returns a configured log.Entry for the given category

func LogAsJSON

func LogAsJSON(entry *log.Entry, lvl log.Level, subject interface{}, msg string, skipIfDebug bool)

LogAsJSON is a convienence method to easily marshal the subject to a json string and log that value in the structured field named "subject"

func Reset

func Reset()

Reset puts the global logger back to its original state; should be called on each invocation of the lambda

Types

type LogCategory

type LogCategory int

LogCategory represents a known logging category type

const (
	DefaultCategory LogCategory = iota
	DevEnvCategory
	DevEnvNotificationCategory
	HTTPCategory
	LambdaCategory
	SnsNotificationCategory
)

Supported logging categories

func (LogCategory) String

func (c LogCategory) String() string

Jump to

Keyboard shortcuts

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