Method: Logging::Appenders::Growl#initialize
- Defined in:
- lib/gems/logging-0.9.4/lib/logging/appenders/growl.rb
#initialize(name, opts = {}) ⇒ Growl
call-seq:
Growl.new( name, opts = {} )
Create an appender that will log messages to the Growl framework on a Mac OS X machine.
22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 |
# File 'lib/gems/logging-0.9.4/lib/logging/appenders/growl.rb', line 22 def initialize( name, opts = {} ) super @growl = "growlnotify -w -n \"#{@name}\" -t \"%s\" -m \"%s\" -p %d &" @coalesce = opts.getopt(:coalesce, false) @title_sep = opts.getopt(:separator) # provides a mapping from the default Logging levels # to the Growl notification levels @map = [-2, -1, 0, 1, 2] map = opts.getopt(:map) self.map = map unless map.nil? setup_coalescing if @coalesce # make sure the growlnotify command can be called unless system('growlnotify -v 2>&1 > /dev/null') self.level = :off ::Logging.log_internal {'growl notifications have been disabled'} end end |