Logger question

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

On Fri, 24 Nov 2006, Brad T. wrote:

Brad
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

open classes - wouldn’t trade them for anything!

kind regards.

-a

On Fri, Nov 24, 2006 at 08:42:21AM +0900, [email protected] wrote:

On Fri, 24 Nov 2006, Brad T. 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:~ > 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

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs