Module: Sass::Logger::LogLevel::ClassMethods
- Defined in:
- /Users/ceppstei/Projects/sass-lang/.sass/lib/sass/logger/log_level.rb
Instance Attribute Summary (collapse)
Instance Method Summary (collapse)
- - define_logger(name, options = {})
- - inherited(subclass)
- - log_level(name, options = {})
- - (Boolean) log_level?(level, min_level)
Instance Attribute Details
- log_levels
15 16 17 | # File '/Users/ceppstei/Projects/sass-lang/.sass/lib/sass/logger/log_level.rb', line 15
def log_levels
@log_levels ||= {}
end |
Instance Method Details
- define_logger(name, options = {})
35 36 37 38 39 40 41 | # File '/Users/ceppstei/Projects/sass-lang/.sass/lib/sass/logger/log_level.rb', line 35
def define_logger(name, options = {})
class_eval <<-RUBY, __FILE__, __LINE__ + 1
def #{name}(message)
#{options.fetch(:to, :log)}(#{name.inspect}, message)
end
RUBY
end |
- inherited(subclass)
9 10 11 | # File '/Users/ceppstei/Projects/sass-lang/.sass/lib/sass/logger/log_level.rb', line 9
def inherited(subclass)
subclass.log_levels = subclass.superclass.log_levels.dup
end |
- log_level(name, options = {})
23 24 25 26 27 28 29 30 31 32 33 | # File '/Users/ceppstei/Projects/sass-lang/.sass/lib/sass/logger/log_level.rb', line 23
def log_level(name, options = {})
if options[:prepend]
level = log_levels.values.min
level = level.nil? ? 0 : level - 1
else
level = log_levels.values.max
level = level.nil? ? 0 : level + 1
end
log_levels.update(name => level)
define_logger(name)
end |
- (Boolean) log_level?(level, min_level)
19 20 21 | # File '/Users/ceppstei/Projects/sass-lang/.sass/lib/sass/logger/log_level.rb', line 19
def log_level?(level, min_level)
log_levels[level] >= log_levels[min_level]
end |