Module: Log4j2LoggerBridge::Helpers

Includes:
Constants
Included in:
Log4j2LoggerBridge
Defined in:
lib/log4j2_logger_bridge/helpers.rb

Overview

The Helpers module

Constant Summary

Constants included from Constants

Constants::DEFAULT_APP_NAME, Constants::DEFAULT_LOGS_DIR_NAME, Constants::DEFAULT_LOG_PATTERN, Constants::DEFAULT_ROLLOVER_SCHEDULE, Constants::DEFAULT_ROLLOVER_SIZE, Constants::DEFAULT_RUBY_LOG_FORMAT, Constants::DEFAULT_TIMESTAMP_FORMAT, Constants::EMPTY_STRING, Constants::NUMERIC_TO_SYMBOL, Constants::SYMBOL_TO_RUBY

Class Method Summary collapse

Class Method Details

.app_logger_nameObject



21
22
23
# File 'lib/log4j2_logger_bridge/helpers.rb', line 21

def app_logger_name
  DEFAULT_APP_NAME
end

.app_nameObject



17
18
19
# File 'lib/log4j2_logger_bridge/helpers.rb', line 17

def app_name
  DEFAULT_APP_NAME
end

.int_to_symbol_level(level) ⇒ Object



37
38
39
40
41
# File 'lib/log4j2_logger_bridge/helpers.rb', line 37

def int_to_symbol_level(level)
  NUMERIC_TO_SYMBOL.fetch(level) do
    level > 5 ? :off : :all
  end
end

.java_log_patternObject



33
34
35
# File 'lib/log4j2_logger_bridge/helpers.rb', line 33

def java_log_pattern
  DEFAULT_LOG_PATTERN
end

.ruby_log_formatObject



29
30
31
# File 'lib/log4j2_logger_bridge/helpers.rb', line 29

def ruby_log_format
  DEFAULT_RUBY_LOG_FORMAT
end

.symbol_to_java_level(sym) ⇒ Object

rubocop: disable Metrics/CyclomaticComplexity



44
45
46
47
48
49
50
51
52
53
54
55
# File 'lib/log4j2_logger_bridge/helpers.rb', line 44

def symbol_to_java_level(sym)
  case sym
  when :off then Level::OFF
  when :fatal then Level::FATAL
  when :error then Level::ERROR
  when :warn then Level::WARN
  when :debug then Level::DEBUG
  when :trace then Level::TRACE
  when :all then Level::ALL
  else Level::INFO
  end
end

.symbol_to_ruby_logger_level(sym, default_level = Logger::INFO) ⇒ Object

rubocop: enable Metrics/CyclomaticComplexity



58
59
60
# File 'lib/log4j2_logger_bridge/helpers.rb', line 58

def symbol_to_ruby_logger_level(sym, default_level = Logger::INFO)
  SYMBOL_TO_RUBY.fetch(sym, default_level)
end

.timestamp_formatObject



25
26
27
# File 'lib/log4j2_logger_bridge/helpers.rb', line 25

def timestamp_format
  DEFAULT_TIMESTAMP_FORMAT
end