Module: Loggr::SLF4J::Jars

Defined in:
lib/loggr/slf4j/jars.rb

Overview

Simple access to both SLF4J and Logback implementations, for testing and/or warbler integration.

Constant Summary collapse

SLF4J_LIB_PATH =

Base dir, where the jar files reside, this is “lib/” ergo “lib/loggr/slf4j/jars.rb/../../../”

File.expand_path(File.dirname(File.dirname(File.dirname(__FILE__))))

Class Method Summary collapse

Class Method Details

.logback_core_jar_pathObject

Logback Core JAR



20
21
22
# File 'lib/loggr/slf4j/jars.rb', line 20

def logback_core_jar_path
  @logback_core_jar_path ||= Dir[File.join(SLF4J_LIB_PATH, 'logback-core-*.jar')].first
end

.logback_jar_pathObject

Logback Classic JAR



26
27
28
# File 'lib/loggr/slf4j/jars.rb', line 26

def logback_jar_path
  @logback_jar_path ||= Dir[File.join(SLF4J_LIB_PATH, 'logback-classic-*.jar')].first
end

.require_slf4j_jars!(all = true) ⇒ Object

Require all JARs, if ‘all` is set to `false`, then only the SLF4J API jar is loaded.



33
34
35
36
37
38
39
# File 'lib/loggr/slf4j/jars.rb', line 33

def require_slf4j_jars!(all = true)
  require self.slf4j_api_jar_path
  if all
    require self.logback_core_jar_path
    require self.logback_jar_path
  end
end

.slf4j_api_jar_pathObject

Path to SLF4J API



14
15
16
# File 'lib/loggr/slf4j/jars.rb', line 14

def slf4j_api_jar_path
  @api_jar_path ||= Dir[File.join(SLF4J_LIB_PATH, 'slf4j-api-*.jar')].first
end