Graylog2/gelf-rb — pull request #23 by meltingice (2014-04-21 20:23:56+00:00)
Title: Adds tagged logging support and Logger::Formatter support

Builds on @mitnal's [PR](https://github.com/Graylog2/gelf-rb/pull/8), which adds tagged logging support, and also adds support for logger formatters.

``` ruby
# 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
```

``` ruby
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
```