[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

comp.lang.ruby

logger question

Brad Tilley

11/23/2006 10:43:00 PM

Is there a way to make logger not write the header line (first line) of a log
file? I'd rather it not write anything but log entries.

# Logfile created on Thu Nov 23 14:44:09 -0500 2006 by logger.rb/1.5.2.9
log_entry
log_entry
log_entry
...

Thanks,
Brad

8 Answers

Ara.T.Howard

11/23/2006 11:42:00 PM

0

Mauricio Fernández

11/24/2006

0

On Fri, Nov 24, 2006 at 08:42:21AM +0900, ara.t.howard@noaa.gov wrote:
> On Fri, 24 Nov 2006, Brad Tilley wrote:
>
> >Is there a way to make logger not write the header line (first line) of a
> >log file? I'd rather it not write anything but log entries.
[...]
> harp:~ > cat a.rb
> require 'logger'
>
> class Logger
> def add_log_header(*a, &b) 42 end
> end
>
> logger = Logger.new STDERR
>
> logger.warn{ "but it's a hack" }
>
>
> harp:~ > ruby a.rb
> W, [2006-11-23T16:41:37.197345 #24482] WARN -- : but it's a hack

$ cat b.rb
require 'logger'

class MyLogger < Logger
def add_log_header(*a, &b) 42 end
end

logger = MyLogger.new STDERR

logger.info{ "implementation inheritance is useful at times" }


$ ruby b.rb
I, [2006-11-24T00:57:53.253757 #5808] INFO -- : implementation inheritance is useful at times

--
Mauricio Fernandez - http://eige... - singular Ruby

Consultant

5/24/2007 11:36:00 PM

0

(article not available)

Consultant

5/24/2007 11:36:00 PM

0

(article not available)

Bugman

5/25/2007 12:18:00 AM

0

(article not available)

Consultant

5/25/2007 12:07:00 PM

0

(article not available)

Consultant

5/25/2007 12:09:00 PM

0

(article not available)

Dave Hazelwood

5/25/2007 12:12:00 PM

0

(article not available)