Passing an existing Logger object to the Roda application #238
jiggneshhgohel
started this conversation in
General
Replies: 2 comments
-
It seems the easiest way to handle this would be to set the logger to a constant in config.ru ( |
Beta Was this translation helpful? Give feedback.
0 replies
-
@jeremyevans That worked. Thanks a lot for your prompt help. |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Background
The background for this discussion can be found between comments #237 (comment) and #237 (comment)
Question
Instead of a Roda application instantiating a Logger inside the application, is it possible to pass an already instantiated Logger to the Roda application? For an example use-case please refer the code in #237 (comment).
@jeremyevans Trying out that code your suspection in your comment #237 (comment) is correct. I created a file
my_plugin.rb
at the level ofapp.rb
itself and in it added following contentThen in my
app.rb
Then when I started the application using
rackup
in terminal following was the outputand the
Rack::Unreloader
logs were written tologs/development.log
file in my application but the request logs were still written to the terminal which is obvious because the plugin was not passed the logger created and set inconfig.ru
.So is there any provision to make this work in Roda-way instead of some workarounds or patch? I think with a concept like
load_plugins_after_app_loads
orlazy_load_plugins
can open up a way to make this work but those are just vague thoughts and how much practical and useful those ideas can be, that only you can comment on.Please share your thoughts.
Thanks.
Beta Was this translation helpful? Give feedback.
All reactions