Documentation ¶
Index ¶
- Constants
- func DeleteMessage(svc sqsiface.SQSAPI, receiptHandle string) (output *sqs.DeleteMessageOutput)
- func LogLevel() (i int)
- func Mustenv(names ...string)
- func QueueURL() string
- func SendMessage(svc sqsiface.SQSAPI, input *sqs.SendMessageInput) (output *sqs.SendMessageOutput)
- type LeveledLogger
- func (l LeveledLogger) Debug(format string, v ...interface{})
- func (l LeveledLogger) Error(format string, v ...interface{})
- func (l LeveledLogger) Info(format string, v ...interface{})
- func (l LeveledLogger) Notice(format string, v ...interface{})
- func (l *LeveledLogger) Panic(format string, v ...interface{})
Constants ¶
const ( LogNone = iota LogError LogNotice LogInfo LogDebug )
Log* constants contain logging levels.
const EnvLogLevel = "LOG_LEVEL"
EnvLogLevel is the environment variable that contains the minimum log level.
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.