logger question

B

Brad Tilley

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
 
A

ara.t.howard

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


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
 
M

Mauricio Fernandez

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Staff online

Members online

Forum statistics

Threads
474,175
Messages
2,570,942
Members
47,489
Latest member
BrigidaD91

Latest Threads

Top