roidrage/lograge

All logs show as INFO

Marcovecchio opened this issue · 0 comments

I'm facing an issue, where all my request logs (processed thru lograge) have the INFO log_level, so I can't filter errors, warns and infos. Looking into the source code, we see that it calls the logger method here, using the Lograge.log_level class variable:

logger.send(Lograge.log_level, formatted_message)

Well, this other line will define what is in Lograge.log_level. It will either use a configured (and fixed) log_level, or falls back to :info, which is what's happening to me, since I don't have any log_level configured:

Lograge.log_level = lograge_config.log_level || :info

My conclusion is that lograge seems to have a fixed log_level, but I need each request log to follow the http status code, otherwise filtering will be harder and non intuitive: it makes no sense to have a 500 error logged as INFO.

We can do a workaround by setting Lograge.log_level to a different level every time a new log is created, but is this the correct way to do it? Does lograge offer a better solution?

Thanks!