dwbutler/logstash-logger

is it possible to set custom log levels

Closed this issue · 3 comments

I would like to switch over to using logstash-logger. However, our current application uses custom levels allowed by Logging gem as allowed by this method: https://github.com/TwP/logging/blob/master/lib/logging.rb#L200

From what I can tell, logstashlogger uses logger.

Is it possible to use similar option with logstash-logger?

Thanks.

If your question is, "will LogStashLogger work with the Logging gem?", the answer appears to be no. Logging provides a very different interface from Ruby's stdlib Logger.

If your question is, "can I use custom log levels with LogStashLogger?", the answer is also no. LogStashLogger only supports whatever Ruby's stdlib Logger supports.

If you tell me more about your use case, perhaps I can recommend an alternative to custom log levels. For example, LogStashLogger allows you to add custom tags and to customize the LogStash::Event in any way you'd like. This might give you enough flexibility to do whatever it is you need to do.

Hi @dwbutler,

Thanks for the quick response. The use case is that I would like to introduce this to a project with custom events. The migration would be much easier if this functionality was available. Without it, I would need to update code in lots of places.

The original use case was to be a bit more descriptive about the logs but that could be handled by use of tags.

In order to conform as closely as possible to Ruby's built in Logger interface, I will probably never support custom log levels. The use case can be implemented using tags.