Hi, I use Logger class in a programm and since I need to log in lot of
different places (into classes, into methods...) I use a global variable in
this way:
$log = Logger.new
$log.debug ...
so I can use $log anywhere in the code. Is it ellegant and "the Ruby way"?
The other possibility I see is creating a class that stores the logger
instance into a @@class_variable (@@logger) and call class method anywhere in
the code:
class MyLogger
@@logger = Logger.new
def self.debug(x)
@@logger.debug(x)
end
...
end
MyLogger.debug ...
Which is a more ellegant way? is there other option?
Thanks for any advice I could receive from you.
--
IƱaki Baz Castillo