-
-
Notifications
You must be signed in to change notification settings - Fork 4
Description
Hi
First of all - thanks for all your amazing work
I have a question/possible improvement, but I'm not sure that's the best way to do it
We are using falcon and decided to use Console for all other logs as well alongside with structured logging.
We would like to log request_id together with all our logs, something like
Rails.logger.tagged({ request_id: 137 }) { Rails.logger.info("log message") }We've seen that Console has .with method for something similar, but, as far as I can see Console::Logger and Console::Adapters::Rails::Logger does not share this functionality
I haven't found a supposed way to do it, so, I started experimenting
Currently, the simplest change I found is:
Allow Console::Compatible::Logger#add to accept **options and pass it to @logdev.call
and
Console::Adapter::Rails::Logger#add to do something like:
options = formatter.tag_stack.tags.each_with_object({}) do |tag, memo|
next unless tag.respond_to?(:merge)
memo.merge!(tag)
end
super(severity, message, progname, **options, &block)But, I'm not sure if this is the best way and if you would approve something like that, so, I'm creating this issue first. Do you have any thoughts?