rudionrails / yell-adapters-gelf

Graylog2 adapter for Yell
MIT License
3 stars 4 forks source link

Make it possible to use global additional gelf parameter #4

Open phlegx opened 10 years ago

phlegx commented 10 years ago

Hi Rudi,

as discussed here: https://github.com/rudionrails/yell/issues/24#issuecomment-25878023 I wanted to add a feature request for the yell-adapters-gelf.

It would be great if one could add a global additional gelf parameter/ field so that every message send to the server would also carry the additional field without explicitly add it to every message directly.

For example additional field "logger_name" submitted for every message:

logger.adapter :gelf, :host => '192.168.65.144',
                              :port => 12201,
                              :facility => DAEMON_NAME + curr_env,
                              "_logger_name" => name

Don't know if such a thing is even possible but I would find this very much useful!

best Martin

phlegx commented 10 years ago

Hi!

Just wanted to push this issue. Please just let me know what you would think about this feature! thank you!

best Martin

OscarBarrett commented 10 years ago

You could use a custom log method.

def log(type, message)
  logger.send(type, message, _name: your_logger_name) 
end

Where type is a symbol of the severity, such as :warning or :error.

rudionrails commented 10 years ago

This feature request applies more to the core yell gem. This could be useful for other adapters as well. I'll have a look at the issue. In the meantime I'd suggest that you use the @OscarBarrett solution.