lib/logging.rb in lorj-1.0.13 vs lib/logging.rb in lorj-1.0.14
- old
+ new
@@ -80,12 +80,10 @@
# # or INFO")
#
# For details, see Logging functions
#
class Logging
- attr_reader :level
-
# Initialize Logging instance
# The log file name is defined by PrcLib.log_file
# The log path is defined by PrcLib.app_name and will be kept as
# ~/.<PrcLib.app_name>
# The log level is defined by PrcLib.level. It will update only log print
@@ -94,11 +92,11 @@
# 'FATAL!!!', 'WARNING' or <LEVEL NAME>
def initialize
file_logger_initialize
@out_logger = Logger.new(STDOUT)
- @level = (PrcLib.level.nil? ? Logger::WARN : PrcLib.level)
+ @level = Logger::WARN
@out_logger.level = @level
@out_logger.formatter = proc do |severity, _datetime, _progname, msg|
case severity
when 'ANY'
str = "#{msg} \n"
@@ -167,10 +165,12 @@
def level=(level)
@level = level
@out_logger.level = level
end
+ attr_reader :level
+
# Print out a message, not logged in the log file. This message is printed
# out systematically as not taking care of logger level.
def unknown(message)
@out_logger.unknown(message + ANSI.clear_eol)
end
@@ -263,9 +263,13 @@
end
def level=(level)
log_object.level = level
nil
+ end
+
+ def level
+ log_object.level
end
# Print the message to the same line.
def state(message, *p)
print(format("%s%s ...\r", ANSI.clear_line,