Module: CemAcpt::Logging::Formatter

Defined in:
lib/cem_acpt/logging/formatter.rb

Defined Under Namespace

Classes: FileFormatter, GithubActionFormatter, JSONFormatter, TextFormatter

Class Method Summary collapse

Class Method Details

.allObject



18
19
20
# File 'lib/cem_acpt/logging/formatter.rb', line 18

def all
  @all ||= [FileFormatter.new, JSONFormatter.new, TextFormatter.new, GithubActionFormatter.new]
end

.for(log_format) ⇒ Object



11
12
13
14
15
16
# File 'lib/cem_acpt/logging/formatter.rb', line 11

def for(log_format)
  formatter = all.find { |f| f.log_format == log_format.downcase.to_sym }
  raise "Unknown log format: #{log_format}" unless formatter

  formatter.get
end

.valid_format?(log_format) ⇒ Boolean

Returns:

  • (Boolean)


7
8
9
# File 'lib/cem_acpt/logging/formatter.rb', line 7

def valid_format?(log_format)
  all.any? { |f| f.log_format == log_format.downcase.to_sym }
end