I have a rails application and want to run some part of it with less memory footprint. Thus I am trying to run these without Rails.
Everything(?) is require
d, but the code crashes, when it reaches calls to logger
.
Is there a way to either create a variable or method logger
globally or add one to the scope of specific classes from the outside? I don't want to remove all logging from the code.
I ended up creating a logger
method in Object
:
class Object
def logger
-> { Logging.logger.root }.call
end
end
Speak up if you have a better solution.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.