fallais / logrus-lumberjack-hook Goto Github PK
View Code? Open in Web Editor NEWLogrus hook for Lumberjack
Logrus hook for Lumberjack
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.
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
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.