lambdautils

package
v0.0.0-...-f36ebf9 Latest Latest
Warning

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

Go to latest
Published: Aug 31, 2019 License: BSD-2-Clause Imports: 9 Imported by: 0

Documentation

Index

Constants

View Source
const (
	LogNone = iota
	LogError
	LogNotice
	LogInfo
	LogDebug
)

Log* constants contain logging levels.

View Source
const EnvLogLevel = "LOG_LEVEL"

EnvLogLevel is the environment variable that contains the minimum log level.

View Source
const EnvQueueURL = "QUEUE_URL"

EnvQueueURL is the environment variable that contains the SQS queue URL. TODO: Can we use Golang build constraints to change this value?

Variables

This section is empty.

Functions

func DeleteMessage

func DeleteMessage(svc sqsiface.SQSAPI, receiptHandle string) (output *sqs.DeleteMessageOutput)

DeleteMessage deletes a message from SQS and panics on any errors.

func LogLevel

func LogLevel() (i int)

LogLevel reads the log level from the EnvLogLevel environment variable and defaults to the info level if it is not set.

func Mustenv

func Mustenv(names ...string)

Mustenv ensures an environment variable is set and panics if it is not.

func QueueURL

func QueueURL() string

QueueURL returns the SQS Queue URL set in the environment variable.

func SendMessage

func SendMessage(svc sqsiface.SQSAPI, input *sqs.SendMessageInput) (output *sqs.SendMessageOutput)

SendMessage sends a message to SQS and panics on any errors.

Types

type LeveledLogger

type LeveledLogger struct {
	ErrorLogger  *log.Logger
	NoticeLogger *log.Logger
	InfoLogger   *log.Logger
	DebugLogger  *log.Logger
}

LeveledLogger is a simple leveled logger that writes logs to STDOUT.

func NewLogger

func NewLogger(level int) *LeveledLogger

NewLogger returns a LeveledLogger that writs logs to os.Stdout or ioutil.Discard depending on the passed minimum log level.

func (LeveledLogger) Debug

func (l LeveledLogger) Debug(format string, v ...interface{})

Debug writes a debug level log.

func (LeveledLogger) Error

func (l LeveledLogger) Error(format string, v ...interface{})

Error writes an error level log.

func (LeveledLogger) Info

func (l LeveledLogger) Info(format string, v ...interface{})

Info writes an info level log

func (LeveledLogger) Notice

func (l LeveledLogger) Notice(format string, v ...interface{})

Notice writes an notice level log.

func (*LeveledLogger) Panic

func (l *LeveledLogger) Panic(format string, v ...interface{})

Panic writes an error level log and panics.

Jump to

Keyboard shortcuts

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