Class: Sass::Logger::Base
- Inherits:
-
Object
- Object
- Sass::Logger::Base
- Includes:
- LogLevel
- Defined in:
- .ruby-sass/lib/sass/logger/base.rb
Direct Known Subclasses
Direct Known Subclasses
Instance Attribute Summary (collapse)
-
#disabled ⇒ Object
Returns the value of attribute disabled.
-
#io ⇒ Object
Returns the value of attribute io.
-
#log_level ⇒ Object
Returns the value of attribute log_level.
Instance Method Summary (collapse)
- #_log(level, message) ⇒ Object
-
#capture ⇒ Object
Captures all logger messages emitted during a block and returns them as a string.
-
#initialize(log_level = :debug, io = nil) ⇒ Base
constructor
A new instance of Base.
- #log(level, message) ⇒ Object
- #logging_level?(level) ⇒ Boolean
Methods included from LogLevel
Constructor Details
#initialize(log_level = :debug, io = nil) ⇒ Base
Returns a new instance of Base
16 17 18 19 |
# File '.ruby-sass/lib/sass/logger/base.rb', line 16 def initialize(log_level = :debug, io = nil) self.log_level = log_level self.io = io end |
Constructor Details
#initialize(log_level = :debug, io = nil) ⇒ Base
Returns a new instance of Base
16 17 18 19 |
# File '.ruby-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 ⇒ Object
Returns the value of attribute disabled
7 8 9 |
# File '.ruby-sass/lib/sass/logger/base.rb', line 7 def disabled @disabled end |
#io ⇒ Object
Returns the value of attribute io
8 9 10 |
# File '.ruby-sass/lib/sass/logger/base.rb', line 8 def io @io end |
#log_level ⇒ Object
Returns the value of attribute log_level
6 7 8 |
# File '.ruby-sass/lib/sass/logger/base.rb', line 6 def log_level @log_level end |
Instance Method Details
#_log(level, message) ⇒ Object
40 41 42 43 44 45 46 |
# File '.ruby-sass/lib/sass/logger/base.rb', line 40 def _log(level, ) if io io.puts() else Kernel.warn() end end |
#capture ⇒ Object
Captures all logger messages emitted during a block and returns them as a string.
27 28 29 30 31 32 33 34 |
# File '.ruby-sass/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) ⇒ Object
36 37 38 |
# File '.ruby-sass/lib/sass/logger/base.rb', line 36 def log(level, ) _log(level, ) if logging_level?(level) end |
#logging_level?(level) ⇒ Boolean
21 22 23 |
# File '.ruby-sass/lib/sass/logger/base.rb', line 21 def logging_level?(level) !disabled && self.class.log_level?(level, log_level) end |