lib/semantic_logger/loggable.rb in semantic_logger-4.2.0 vs lib/semantic_logger/loggable.rb in semantic_logger-4.2.1
- old
+ new
@@ -28,11 +28,10 @@
# * To forcibly replace Rails or any other existing logging methods
# use `prepend` instead of `include`. For example:
# ExternalSupplier.prepend SemanticLogger::Loggable
module SemanticLogger
module Loggable
-
def self.included(base)
base.extend ClassMethods
base.class_eval do
# Returns [SemanticLogger::Logger] class level logger
def self.logger
@@ -83,18 +82,18 @@
# return false
# end
index = SemanticLogger.level_to_index(level)
- logger_measure_module.module_eval(<<-EOT, __FILE__, __LINE__ + 1)
+ logger_measure_module.module_eval(<<~MEASURE_METHOD, __FILE__, __LINE__ + 1)
def #{method_name}(*args, &block)
if logger.send(:level_index) <= #{index}
logger.send(
:measure_method,
- index: #{index},
- level: #{level.inspect},
- message: #{message.inspect},
+ index: #{index},
+ level: #{level.inspect},
+ message: #{message.inspect},
min_duration: #{min_duration},
metric: #{metric.inspect},
log_exception: #{log_exception.inspect},
on_exception_level: #{on_exception_level.inspect}
) do
@@ -102,12 +101,12 @@
end
else
super(*args, &block)
end
end
- EOT
- #{"#{visibility} :#{method_name}" unless visibility == :public}
+ MEASURE_METHOD
+ # {"#{visibility} :#{method_name}" unless visibility == :public}
true
end
private
@@ -119,10 +118,8 @@
mod = const_set(:SemanticLoggerMeasure, Module.new)
prepend mod
mod
end
end
-
end
-
end
end