From: Tom Cloyd Date: 2009-05-06T11:27:35+09:00 Subject: Re: my logroll code, please critique Derek Smith wrote: > Joel VanderWerf wrote: > >> Derek Smith wrote: >> >>> Will anyone share good sample code for logging? >>> >> There's the logger.rb in the ruby standard library (or did someone >> mention that already?). It handles rotation, log levels, but perhaps not >> multiprocess safety. >> > > Here is my updated code, but how do I look at the documentation from the > CLI for logger, logging or any gem? For example, if I want to look at > Perl docs I use perldoc -f "builtin function" or perldoc -q "F.A.Q." > Finally, what about a central logging block for when at anytime 'raise > StandardError' is called, the script will log to one logfile. Will > anyone suggest code or how to do this? > > Google "ruby logger" and you get right to the RDoc documentation - http://www.ruby-doc.org/stdlib/libdoc/logger/rdoc/index.html Access the "logger" class and you'll get some very good documentation. Re: errors - the standard error stream goes to STDERR, a constant ruby automatically creates. Normally, this goes to STDOUT - the standard output stream, assigned to your screen, but you can reassign it: $stderr = File.new( 'myerrs.txt','w' ) Hope this helps... t. -- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Tom Cloyd, MS MA, LMHC - Private practice Psychotherapist Bellingham, Washington, U.S.A: (360) 920-1226 << tc@tomcloyd.com >> (email) << TomCloyd.com >> (website) << sleightmind.wordpress.com >> (mental health weblog) ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~