# class Sass::Logger::Base

### Attributes

disabled[RW]
io[RW]
log_level[RW]

### Public Class Methods

new(log_level = :debug, io = nil) click to toggle source

    # File lib/sass/logger/base.rb, line 16
    def initialize(log_level = :debug, io = nil)
      self.log_level = log_level
      self.io = io
    end

### Public Instance Methods

_log(level, message) click to toggle source

    # File lib/sass/logger/base.rb, line 40
    def _log(level, message)
      if io
        io.puts(message)
      else
        Kernel.warn(message)
      end
    end

capture() { || ... } click to toggle source

Captures all logger messages emitted during a block and returns them as a string.

    # File lib/sass/logger/base.rb, line 27
    def capture
      old_io = io
      self.io = StringIO.new
      yield
      io.string
    ensure
      self.io = old_io
    end

log(level, message) click to toggle source

    # File lib/sass/logger/base.rb, line 36
    def log(level, message)
      _log(level, message) if logging_level?(level)
    end

logging_level?(level) click to toggle source

    # File lib/sass/logger/base.rb, line 21
    def logging_level?(level)
      !disabled && self.class.log_level?(level, log_level)
    end