I'm looking to recreate functionality that ruby's built-in Logger has, but I'm struggling to do so.
Logger:
$logger = Logger.new(STDOUT)
def foo
$logger.info (__method__) { "this is my log" }
end
foo
=> I, [2018-01-10T12:36:42.436592 #57345] INFO -- foo: this is my log
With Logging, I don't see the ability to pass an appender when calling it. I also can't think of any way to do this when instantiating the Logging instance, since method will evaluate to whatever method is doing the instantiation, and using something like caller_locations will provide the caller locations for the instantiating method, not the method making a logging call.
I'm looking to recreate functionality that ruby's built-in Logger has, but I'm struggling to do so.
Logger:
With Logging, I don't see the ability to pass an appender when calling it. I also can't think of any way to do this when instantiating the Logging instance, since method will evaluate to whatever method is doing the instantiation, and using something like caller_locations will provide the caller locations for the instantiating method, not the method making a logging call.
Any ideas?