Class: BatchKit::Logging::JavaLogFacade

Inherits:
Object
  • Object
show all
Defined in:
lib/batch-kit/logging/java_util_logger.rb

Constant Summary collapse

LEVEL_MAP =
{
    :error => Java::JavaUtilLogging::Level::SEVERE,
    :warning => Java::JavaUtilLogging::Level::WARNING,
    :info => Java::JavaUtilLogging::Level::INFO,
    :config => Java::JavaUtilLogging::Level::CONFIG,
    :detail => Java::JavaUtilLogging::Level::FINE,
    :trace => Java::JavaUtilLogging::Level::FINER,
    :debug => Java::JavaUtilLogging::Level::FINEST
}

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(logger) ⇒ JavaLogFacade

Returns a new instance of JavaLogFacade.



24
25
26
# File 'lib/batch-kit/logging/java_util_logger.rb', line 24

def initialize(logger)
    @java_logger = logger
end

Dynamic Method Handling

This class handles dynamic methods through the method_missing method

#method_missing(mthd, *args) ⇒ Object



78
79
80
# File 'lib/batch-kit/logging/java_util_logger.rb', line 78

def method_missing(mthd, *args)
    @java_logger.send(mthd, *args)
end

Instance Attribute Details

#log_fileObject

Returns The path to any log file used with this logger.

Returns:

  • The path to any log file used with this logger



21
22
23
# File 'lib/batch-kit/logging/java_util_logger.rb', line 21

def log_file
  @log_file
end

Instance Method Details

#levelObject



29
30
31
# File 'lib/batch-kit/logging/java_util_logger.rb', line 29

def level
    LEVEL_MAP.invert[@java_logger.getLevel()]
end

#level=(level) ⇒ Object



34
35
36
# File 'lib/batch-kit/logging/java_util_logger.rb', line 34

def level=(level)
    @java_logger.setLevel(LEVEL_MAP[level])
end