Class: TTK::Logger::Verbosity

Inherits:
Object
  • Object
show all
Defined in:
lib/ttk/logger/verbosity.rb

Constant Summary collapse

@@level_fields =
[]
@@higher_level =
0

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.higher_levelObject



18
19
20
# File 'lib/ttk/logger/verbosity.rb', line 18

def self.higher_level
  @@higher_level
end

.level_fields(level) ⇒ Object



35
36
37
38
# File 'lib/ttk/logger/verbosity.rb', line 35

def self.level_fields(level)
  @@level_fields[level] ||= []
  @@level_fields[level]
end

.verbosity(meth, level) ⇒ Object



22
23
24
25
26
27
28
29
30
31
32
33
# File 'lib/ttk/logger/verbosity.rb', line 22

def self.verbosity(meth, level)
  unless method_defined?(meth)
    raise(ArgumentError, "`#{meth}' - is not an instance method")
  end
  if level <= 0
    raise(ArgumentError,
          "`#{level}' - verbosity level must be strictly positive")
  end
  @@higher_level = level if level > @@higher_level
  @@level_fields[level] ||= []
  @@level_fields[level] << meth
end

Instance Method Details

#date(severity_level, section_names) ⇒ Object



50
51
52
# File 'lib/ttk/logger/verbosity.rb', line 50

def date(severity_level, section_names)
  Time.now
end

#sections(severity_level, section_names) ⇒ Object



45
46
47
# File 'lib/ttk/logger/verbosity.rb', line 45

def sections(severity_level, section_names)
  section_names
end

#severity_level(severity_level, section_names) ⇒ Object



40
41
42
# File 'lib/ttk/logger/verbosity.rb', line 40

def severity_level(severity_level, section_names)
  Severity.label(severity_level)
end