Class: Logging::Appenders::Growl

### Home Classes Methods

### In Files

- lib/logging/appenders/growl.rb

### Parent

Logging::Appender

### Methods

- ::new
- #map=

### Files

- History.txt
- README.rdoc

### Class/Module Index

Quicksearch

- Logging
- Logging::Appender
- Logging::Appenders
- Logging::Appenders::Buffering
- Logging::Appenders::Email
- Logging::Appenders::File
- Logging::Appenders::Growl
- Logging::Appenders::IO
- Logging::Appenders::RollingFile
- Logging::Appenders::Stderr
- Logging::Appenders::Stdout
- Logging::Appenders::StringIo
- Logging::Appenders::Syslog
- Logging::ColorScheme
- Logging::Config
- Logging::Config::Configurator
- Logging::Config::Configurator::DSL
- Logging::Config::Configurator::Error
- Logging::Config::Configurator::TopLevelDSL
- Logging::Config::YamlConfigurator
- Logging::Config::YamlConfigurator::Error
- Logging::Layout
- Logging::Layouts
- Logging::Layouts::Basic
- Logging::Layouts::Parseable
- Logging::Layouts::Pattern
- Logging::Logger
- Logging::MappedDiagnosticContext
- Logging::NestedDiagnosticContext
- Logging::Proxy
- Logging::RailsCompat
- Logging::Repository
- Logging::Repository::Singleton
- Logging::RootLogger
- Logging::Stats
- Logging::Stats::Sampler
- Logging::Stats::Tracker
- RSpec
- RSpec::Core
- RSpec::Core::Configuration
- RSpec::LoggingHelper
- RSpec::LoggingHelper
- Spec
- Spec::Runner
- Spec::Runner::Configuration
- Object
- Object::LoggingHelper
- File
- FileUtils
- Hash
- Kernel
- Module
- ReentrantMutex
- String

No matching classes.

# Logging::Appenders::Growl

This class provides an Appender that can send notifications to the Growl notification system on Mac OS X.

`growlnotify` must be installed somewhere in the path in order for the appender to function properly.

### Public Class Methods

new( name, opts = {} ) click to toggle source

Create an appender that will log messages to the Growl framework on a Mac OS X machine.

    # File lib/logging/appenders/growl.rb, line 29
    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 >> /dev/null 2>&1')
        self.level = :off
        ::Logging.log_internal {'growl notifications have been disabled'}
      end
    end

### Public Instance Methods

map = { logging_levels => growl_levels } click to toggle source

Configure the mapping from the Logging levels to the Growl notification levels. This is needed in order to log events at the proper Growl level.

Without any configuration, the following mapping will be used:

    :debug  =>  -2
    :info   =>  -1
    :warn   =>  0
    :error  =>  1
    :fatal  =>  2

    # File lib/logging/appenders/growl.rb, line 67
    def map=( levels )
      map = []
      levels.keys.each do |lvl|
        num = ::Logging.level_num(lvl)
        map[num] = growl_level_num(levels[lvl])
      end
      @map = map
    end

[Validate]

Generated with the Darkfish Rdoc Generator 2.