atshook

package module
v0.0.0-...-5326c6e Latest Latest
Warning

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

Go to latest
Published: Aug 20, 2017 License: Apache-2.0 Imports: 5 Imported by: 0

README

Azure Table Storage Hooks for Logrus

Usage


package main

import (
	log "github.com/sirupsen/logrus"
	"github.com/kpfaulkner/azuretablehook"
	)

func main() {

    // Azure Storage keys can either be provided in the NewHook method or it will be read from environment variables
    // ACCOUNT_NAME and ACCOUNT_KEY
    log.AddHook( atshook.NewHook("XXXXX Azure account name XXXX", "XXXX Azure account key XXXXX", "mylogtable", 
    log.DebugLevel) )
    log.SetLevel( log.DebugLevel)

    log.WithFields(log.Fields{
        "species": "cat",
        "name" :"fred",
        "number": 1,
    }).Info("A cat was here")
}

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AtsHook

type AtsHook struct {
	// contains filtered or unexported fields
}

AtsHook to handle writing to Azure Table Storage

func NewHook

func NewHook(accountName string, accountKey string, tableName string, level logrus.Level) *AtsHook

NewHook creates a new instance of atsHook. The accountName, accountKey and tableName for Azure are required.

func (*AtsHook) Fire

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

Fire adds the logrus entry to Azure Table Storage

func (*AtsHook) Levels

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

Levels returns configured log levels

Jump to

Keyboard shortcuts

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