Class: Sass::Logger::Base

Inherits:
Object
  • Object
show all
Includes:
LogLevel
Defined in:
/home/nweiz/code/sass-site/.sass/lib/sass/logger/base.rb

Direct Known Subclasses

Delayed

Instance Attribute Summary (collapse)

Instance Method Summary (collapse)

Constructor Details

- (Base) initialize(log_level = :debug, io = nil)

Returns a new instance of Base



16
17
18
19
# File '/home/nweiz/code/sass-site/.sass/lib/sass/logger/base.rb', line 16

def initialize(log_level = :debug, io = nil)
  self.log_level = log_level
  self.io = io
end

Instance Attribute Details

- disabled

Returns the value of attribute disabled



7
8
9
# File '/home/nweiz/code/sass-site/.sass/lib/sass/logger/base.rb', line 7

def disabled
  @disabled
end

- io

Returns the value of attribute io



8
9
10
# File '/home/nweiz/code/sass-site/.sass/lib/sass/logger/base.rb', line 8

def io
  @io
end

- log_level

Returns the value of attribute log_level



6
7
8
# File '/home/nweiz/code/sass-site/.sass/lib/sass/logger/base.rb', line 6

def log_level
  @log_level
end

Instance Method Details

- _log(level, message)



29
30
31
32
33
34
35
# File '/home/nweiz/code/sass-site/.sass/lib/sass/logger/base.rb', line 29

def _log(level, message)
  if io
    io.puts(message)
  else
    Kernel.warn(message)
  end
end

- log(level, message)



25
26
27
# File '/home/nweiz/code/sass-site/.sass/lib/sass/logger/base.rb', line 25

def log(level, message)
  _log(level, message) if logging_level?(level)
end

- (Boolean) logging_level?(level)

Returns:

  • (Boolean)


21
22
23
# File '/home/nweiz/code/sass-site/.sass/lib/sass/logger/base.rb', line 21

def logging_level?(level)
  !disabled && self.class.log_level?(level, log_level)
end