evalphobia / logrus_fluent

fluentd hooks for logrus
Apache License 2.0
45 stars 22 forks source link

"tag" field is removed from passed entry. #5

Closed echupriyanov closed 8 years ago

echupriyanov commented 8 years ago

I'm trying to use preset *logrus.Entry with a "rag" field, so I don't have to specify tag on each log message. Example:

    hook := logrus_fluent.NewHook("fluent-es-dev.cybertonica.aws", 24224)
    myLogger := logrus.New()
    myLogger.Hooks.Add(hook)
    myLogger.Formatter = new(logrus.JSONFormatter)
    myLogger.Level = logrus.DebugLevel
    myLog := myLogger.WithFields(logrus.Fields{"tag": "debug.scratch.test", "host": "iMac-eric"})

    myLog.Debug("First message")
    myLog.Debug("Second message")

First message is correctly tagged and sent to Fluentd, but second one is un-tagged.

I suggest to make a copy of entry's data in Fire call work with it, but not with original entry passed

evalphobia commented 8 years ago

merged #6