Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Ruby > my logroll code, please critique

Reply
Thread Tools

my logroll code, please critique

 
 
Tom Cloyd
Guest
Posts: n/a
 
      05-06-2009
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/libdo...doc/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
<< >> (email)
<< TomCloyd.com >> (website)
<< sleightmind.wordpress.com >> (mental health weblog)
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~


 
Reply With Quote
 
 
 
 
Tom Cloyd
Guest
Posts: n/a
 
      05-06-2009
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?
>
>

More on finding documentation -

I can't help you if you're on a Winxxxx system, but on my Kubuntu Linux
OS I can find useful documentation for the "logger" standard library
member (and others) by issuing at my CLI -

which logger

I get a pile of locations on the filesys where "logger" appears. Many
are irrelevant, but this one is not:

/usr/share/doc/ruby1.8-examples/examples/logger

There I find 3 ruby code files illustrating library use. Nice.

(I didn't know about this until I set out to find an answer to your
question, so thanks to you for that.)

t.

--

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~
Tom Cloyd, MS MA, LMHC - Private practice Psychotherapist
Bellingham, Washington, U.S.A: (360) 920-1226
<< >> (email)
<< TomCloyd.com >> (website)
<< sleightmind.wordpress.com >> (mental health weblog)
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~


 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Critique food site please Nik Coughlin HTML 33 03-06-2006 07:15 AM
Feedback/critique my website please? Familyman HTML 24 02-12-2006 02:21 AM
Please critique this HTA (Change Database Remotely) Highlander HTML 9 12-07-2005 06:41 AM
critique these sites please Developwebsites HTML 15 09-20-2004 10:49 PM
edgesoft.ca site critique please Long HTML 5 10-21-2003 09:18 PM



Advertisments
 



1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57