graylog-labs / gelf-rb

Ruby GELF library (Graylog Extended Log Format)
https://rubygems.org/gems/gelf
MIT License
153 stars 104 forks source link

Adds tagged logging support and Logger::Formatter support #23

Closed meltingice closed 6 years ago

meltingice commented 10 years ago

Builds on @mitnal's PR, which adds tagged logging support, and also adds support for logger formatters.

# Example formatter.
# Unlike most formatters, message is a hash.
# Must return a hash as well.
class MyGelfFormatter < Logger::Formatter
  def call(severity, datetime, facility, message)
    message.merge({
      pid: Process.pid
    })
  end
end
config.log_tags = [:uuid, :remote_ip]
config.logger = GELF::Logger.new("localhost", 12201, 'LAN', {
  tags: [:uuid, :remote_ip] # same order as config.log_tags !
})

config.logger = MyGelfFormatter.new
joschi commented 9 years ago

Thanks for contributing to this project! To continue merging this PR, we need you to sign our Individual Contributor Assignment Agreement as described in https://www.graylog.org/contributing-to-graylog/

@meltingice Would you mind cleaning up those commits a little bit and rebase to current master? There are some unintended changes in this PR, like the unresolved conflicts in .travis.yml.

milgner commented 8 years ago

Seems like this is partly a duplicate of #35 now. Also, besides history cleanup, would you mind creating separate PRs for formatter support and tagged logging?

jalogisch commented 6 years ago

@milgner I would like to close this PR - CLA is still beding and this is kind of outdated and might need some love.

How would you decide?

jalogisch commented 6 years ago

As if the missing CLA i'll close this PR now