W
Will Parsons
I'm developing a daemon written in Ruby and in the course of development I
like to see various status messages printed at crucial points to aid in
debugging. Since this is a daemon, I use syslog and create a global $log
variable to handle log messages, essentially like the following:
require 'syslog'
....
$log = Syslog.open('progname', Syslog::LOG_PID, log_facility)
....
$log.debug some_message
This has worked well as long as the whole program is contained in a single
file, but as the program has gradually increased in complexity, I wish to
remove the definition of some classes to their own files and "require" them
in the main ruby source file. This means that whatever is removed to a
separate file no longer has access to the global variable $log. Any
suggestions on how to best handle status/debug messages from these
subsidiary files?
like to see various status messages printed at crucial points to aid in
debugging. Since this is a daemon, I use syslog and create a global $log
variable to handle log messages, essentially like the following:
require 'syslog'
....
$log = Syslog.open('progname', Syslog::LOG_PID, log_facility)
....
$log.debug some_message
This has worked well as long as the whole program is contained in a single
file, but as the program has gradually increased in complexity, I wish to
remove the definition of some classes to their own files and "require" them
in the main ruby source file. This means that whatever is removed to a
separate file no longer has access to the global variable $log. Any
suggestions on how to best handle status/debug messages from these
subsidiary files?