### Home Classes Methods

### In Files

- lib/compass/logger.rb

### Parent

Object

### Methods

- ::new
- #action_padding
- #color
- #emit
- #log
- #max_action_length
- #record
- #red
- #yellow

### Class/Module Index

Quicksearch

- Compass
- Compass::Actions
- Compass::AppIntegration
- Compass::AppIntegration::Helpers
- Compass::AppIntegration::Rails
- Compass::AppIntegration::StandAlone
- Compass::AppIntegration::StandAlone::ConfigurationDefaults
- Compass::AppIntegration::StandAlone::Installer
- Compass::BrowserSupport
- Compass::Commands
- Compass::Commands::Base
- Compass::Commands::CleanProject
- Compass::Commands::CleanProjectOptionsParser
- Compass::Commands::CompileProjectOptionsParser
- Compass::Commands::ConfigurationOptionsParser
- Compass::Commands::CreateProject
- Compass::Commands::CreateProjectOptionsParser
- Compass::Commands::Default
- Compass::Commands::DefaultOptionsParser
- Compass::Commands::ExtensionCommand
- Compass::Commands::ExtensionOptionsParser
- Compass::Commands::ExtensionsOptionParser
- Compass::Commands::GenerateGridBackground
- Compass::Commands::GridBackgroundOptionsParser
- Compass::Commands::Help
- Compass::Commands::HelpOptionsParser
- Compass::Commands::Imports
- Compass::Commands::InstallerCommand
- Compass::Commands::Interactive
- Compass::Commands::InteractiveOptionsParser
- Compass::Commands::ListFrameworks
- Compass::Commands::MemoryDebugger
- Compass::Commands::PrintVersion
- Compass::Commands::ProjectBase
- Compass::Commands::ProjectStats
- Compass::Commands::Registry
- Compass::Commands::Sprite
- Compass::Commands::SpriteOptionsParser
- Compass::Commands::StampPattern
- Compass::Commands::StampPatternOptionsParser
- Compass::Commands::StatsOptionsParser
- Compass::Commands::StructureOptionsParser
- Compass::Commands::UnpackExtension
- Compass::Commands::UpdateProject
- Compass::Commands::ValidateProject
- Compass::Commands::ValidationOptionsParser
- Compass::Commands::VersionOptionsParser
- Compass::Commands::WatchProject
- Compass::Commands::WatchProjectOptionsParser
- Compass::Commands::WriteConfiguration
- Compass::Compiler
- Compass::Configuration
- Compass::Configuration::Adapters
- Compass::Configuration::Comments
- Compass::Configuration::Data
- Compass::Configuration::Defaults
- Compass::Configuration::FileData
- Compass::Configuration::Helpers
- Compass::Configuration::Inheritance
- Compass::Configuration::Inheritance::ClassMethods
- Compass::Configuration::Inheritance::ClassMethods::ArrayProxy
- Compass::Configuration::Inheritance::InstanceMethods
- Compass::Configuration::Paths
- Compass::Configuration::Serialization
- Compass::Error
- Compass::Exec
- Compass::Exec::CommandOptionParser
- Compass::Exec::GlobalOptionsParser
- Compass::Exec::Helpers
- Compass::Exec::ProjectOptionsParser
- Compass::Exec::SubCommandUI
- Compass::Exec::SwitchUI
- Compass::FilesystemConflict
- Compass::Frameworks
- Compass::Frameworks::Framework
- Compass::GridBuilder
- Compass::Installers
- Compass::Installers::BareInstaller
- Compass::Installers::Base
- Compass::Installers::Manifest
- Compass::Installers::Manifest::Entry
- Compass::Installers::ManifestInstaller
- Compass::Installers::TemplateContext
- Compass::Logger
- Compass::MissingDependency
- Compass::NullLogger
- Compass::PNG
- Compass::SassExtensions
- Compass::SassExtensions::Functions
- Compass::SassExtensions::Functions::Colors
- Compass::SassExtensions::Functions::Constants
- Compass::SassExtensions::Functions::CrossBrowserSupport
- Compass::SassExtensions::Functions::CrossBrowserSupport::CSS2FallbackValue
- Compass::SassExtensions::Functions::Display
- Compass::SassExtensions::Functions::Enumerate
- Compass::SassExtensions::Functions::Env
- Compass::SassExtensions::Functions::FontFiles
- Compass::SassExtensions::Functions::GradientSupport
- Compass::SassExtensions::Functions::GradientSupport::Assertions
- Compass::SassExtensions::Functions::GradientSupport::ColorStop
- Compass::SassExtensions::Functions::GradientSupport::Functions
- Compass::SassExtensions::Functions::GradientSupport::Gradient
- Compass::SassExtensions::Functions::GradientSupport::Gradient::ClassMethods
- Compass::SassExtensions::Functions::GradientSupport::LinearGradient
- Compass::SassExtensions::Functions::GradientSupport::RadialGradient
- Compass::SassExtensions::Functions::ImageSize
- Compass::SassExtensions::Functions::ImageSize::ImageProperties
- Compass::SassExtensions::Functions::ImageSize::JPEG
- Compass::SassExtensions::Functions::InlineImage
- Compass::SassExtensions::Functions::Lists
- Compass::SassExtensions::Functions::Math
- Compass::SassExtensions::Functions::Selectors
- Compass::SassExtensions::Functions::Sprites
- Compass::SassExtensions::Functions::Sprites::VariableReader
- Compass::SassExtensions::Functions::Urls
- Compass::SassExtensions::Functions::Urls::FontUrl
- Compass::SassExtensions::Functions::Urls::GeneratedImageUrl
- Compass::SassExtensions::Functions::Urls::ImageUrl
- Compass::SassExtensions::Functions::Urls::StylesheetUrl
- Compass::SassExtensions::Sprites
- Compass::SassExtensions::Sprites::ChunkyPngEngine
- Compass::SassExtensions::Sprites::Engine
- Compass::SassExtensions::Sprites::Image
- Compass::SassExtensions::Sprites::ImageMethods
- Compass::SassExtensions::Sprites::ImageRow
- Compass::SassExtensions::Sprites::LayoutMethods
- Compass::SassExtensions::Sprites::RowFitter
- Compass::SassExtensions::Sprites::SpriteMap
- Compass::SassExtensions::Sprites::SpriteMethods
- Compass::SpriteException
- Compass::SpriteImporter
- Compass::Sprites
- Compass::Sprites::Binding
- Compass::Stats
- Compass::Stats::CssFile
- Compass::Stats::SassFile
- Compass::Stats::StatsVisitor
- Compass::TestCase
- Compass::Util
- Compass::Version
- Sass
- Sass::Script
- Sass::Script::CrossBrowserFunctionCall
- Sass::Script::Funcall
- Sass::Script::Functions
- Sass::Script::Functions::EvaluationContext
- Sass::Script::HasSimpleCrossBrowserFunctionSupport
- Sass::Script::List
- Sass::Tree
- Sass::Tree::Node
- QuickCache

No matching classes.

# Compass::Logger

### Constants

ACTION_COLORS
COLORS
DEFAULT_ACTIONS

### Attributes

actions[RW]
options[RW]

### Public Class Methods

new(*actions) click to toggle source

    # File lib/compass/logger.rb, line 26
    def initialize(*actions)
      self.options = actions.last.is_a?(Hash) ? actions.pop : {}
      @actions = DEFAULT_ACTIONS.dup
      @actions += actions
    end

### Public Instance Methods

action_padding(action) click to toggle source

add padding to the left of an action that was performed.

    # File lib/compass/logger.rb, line 82
    def action_padding(action)
      ' ' * [(max_action_length - action.to_s.length), 0].max
    end

color(c) click to toggle source

    # File lib/compass/logger.rb, line 60
    def color(c)
      if Compass.configuration.color_output && c && COLORS.has_key?(c.to_sym)
        if defined?($boring) && $boring
          ""
        else
          "\e[#{COLORS[c.to_sym]}m"
        end
      else
        ""
      end
    end

emit(msg) click to toggle source

    # File lib/compass/logger.rb, line 72
    def emit(msg)
      print msg
    end

log(msg) click to toggle source

Emit a log message

    # File lib/compass/logger.rb, line 77
    def log(msg)
      puts msg
    end

max_action_length() click to toggle source

the maximum length of all the actions known to the logger.

    # File lib/compass/logger.rb, line 87
    def max_action_length
      @max_action_length ||= actions.inject(0){|memo, a| [memo, a.to_s.length].max}
    end

record(action, *arguments) click to toggle source

Record an action that has occurred

    # File lib/compass/logger.rb, line 33
    def record(action, *arguments)
      msg = ""
      msg << color(ACTION_COLORS[action]) if Compass.configuration.color_output
      msg << "#{action_padding(action)}#{action}"
      msg << color(:clear) if Compass.configuration.color_output
      msg << " #{arguments.join(' ')}"
      log msg
    end

red() click to toggle source

    # File lib/compass/logger.rb, line 42
    def red
      $stderr.write(color(:red))
      $stdout.write(color(:red))
      yield
    ensure
      $stderr.write(color(:clear))
      $stdout.write(color(:clear))
    end

yellow() click to toggle source

    # File lib/compass/logger.rb, line 51
    def yellow
      $stderr.write(color(:yellow))
      $stdout.write(color(:yellow))
      yield
    ensure
      $stderr.write(color(:clear))
      $stdout.write(color(:clear))
    end

[Validate]

Generated with the Darkfish Rdoc Generator 2.