Sha256: 38e29db14db733901a8f2005bcff8259d1852c3afdbe725aa607f1b4bb131969
Contents?: true
Size: 1.08 KB
Versions: 4
Compression:
Stored size: 1.08 KB
Contents
module Mirah module Logging java_import 'java.util.logging.Logger' java_import 'java.util.logging.Formatter' java_import 'java.util.logging.ConsoleHandler' java_import 'java.util.logging.Level' MirahLogger = Logger.getLogger('org.mirah') module Logged VLEVELS = [Level::CONFIG, Level::FINE, Level::FINER, Level::FINEST] def logger @logger ||= java.util.logging.Logger.getLogger(logger_name) end def logger_name name = self.class.name.sub(/^Mirah::/, '').gsub('::', '.') "org.mirah.ruby.#{name}" end def error(*args) logger.log(Level::SEVERE, *args) end def warning(*args) logger.log(Level::WARNING, *args) end def info(*args) logger.log(Level::INFO, *args) end def log(*args) vlog(1, *args) end def logging?(level=Level::FINE) level = VLEVELS[level] unless level.kind_of?(Level) logger.isLoggable(level) end def vlog(level, *args) logger.log(VLEVELS[level], *args) end end end end
Version data entries
4 entries across 4 versions & 1 rubygems
Version | Path |
---|---|
mirah-0.2.1-java | lib/mirah/util/logging.rb |
mirah-0.2.0-java | lib/mirah/util/logging.rb |
mirah-0.1.4-java | lib/mirah/util/logging.rb |
mirah-0.1.3-java | lib/mirah/util/logging.rb |