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://eigenclass.org   -  singular Ruby