Giter Site home page Giter Site logo

logrus-lumberjack-hook's People

Contributors

deefstes avatar fallais avatar

Stargazers

 avatar  avatar

Watchers

 avatar  avatar

logrus-lumberjack-hook's Issues

logrus-lumberjack-hook release

can you please add a release ?
(for example release 1.0)

so other people can add constraints in the gopkg.toml files for 'dep ensure'?

Currently I'm using the last master revision as a dep constraint.

Unable to run example code

Hi! I just started with g Go and I believe your solution May solve my problem.

BUt I'm unable to run the example code you gave.

Code:

package main

import (
	logrus_lumberjack "github.com/fallais/logrus-lumberjack-hook"
	"github.com/natefinch/lumberjack"
	"github.com/rifflock/lfshook"
	"github.com/sirupsen/logrus"
	log "github.com/sirupsen/logrus"
)

// Create new instance of logger.
//var log = logrus.New()

func main() {
	//log.Out = os.Stdout

	pathMap := lfshook.PathMap{
		log.InfoLevel: "/home/alan/Documents/dev/GO Tests/File IO/info/info.log",
		log.WarnLevel: "/home/alan/Documents/dev/GO Tests/File IO/warn/warn.log",
	}

	// Set the Lumberjack logger
	lumberjackLogger := &lumberjack.Logger{
		Filename:   "/var/log/misc.log",
		MaxSize:    10,
		MaxBackups: 3,
		MaxAge:     3,
		LocalTime:  true,
	}
	// Add Lumberjack hook
	hook, err := logrus_lumberjack.NewLumberjackHook(lumberjackLogger)
	if err != nil {
		logrus.Fatalln("Unable to add the Lumberjack hook :", err)
	} else {
		logrus.AddHook(hook)
	}

	myLog := log.New()
	myLog.Hooks.Add(lfshook.NewHook(
		pathMap,
		&log.TextFormatter{},
	))

	//requestLogger := log.WithFields(log.Fields{"nome": "Name", "sobrenome": "LastName"})
	myLog.WithField("Nome", "Alan").Info("This is an INFO log level.")
	myLog.WithField("Nome", "Alan").Warn("Hello WOrld")

}

The error:

# command-line-arguments
./main.go:31:50: cannot use lumberjackLogger (type *"github.com/natefinch/lumberjack".Logger) as type *"gopkg.in/natefinch/lumberjack.v2".Logger in argument to logrus_lumberjack.NewLumberjackHoo

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.