logrus_sqs

package module
v0.0.0-...-3f17ab3 Latest Latest
Warning

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

Go to latest
Published: Nov 7, 2017 License: MIT Imports: 6 Imported by: 0

README

SQS Hook for Logrus

Installation

$ go get github.com/tsarpaul/logrus_sqs

Usage
package main

import (
	"github.com/Sirupsen/logrus"
	"github.com/tsarpaul/logrus_sqs"
)

func main() {
	sqsHook, err := logrus_sqs.NewSQSHook("random_queue_name", "eu-central-1")
	if err != nil {
		panic(err)
	}
	log.AddHook(sqsHook)

	log.WithFields(log.Fields{
		"hello": "world",
	}).Info("Hello world!")
}

You may provide a custom AWS Session with logrus_sqs.NewSQSHookWithSession

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type SQSHook

type SQSHook struct {
	Session  *sqs.SQS
	QueueUrl *string
}

func NewSQSHook

func NewSQSHook(QueueName string, region string) (*SQSHook, error)

func NewSQSHookWithSession

func NewSQSHookWithSession(queueName string, sess *session.Session) (*SQSHook, error)

func (*SQSHook) Fire

func (hook *SQSHook) Fire(entry *logrus.Entry) error

func (*SQSHook) Levels

func (hook *SQSHook) Levels() []logrus.Level

Jump to

Keyboard shortcuts

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