lib/semantic_logger/base.rb in semantic_logger-4.4.0 vs lib/semantic_logger/base.rb in semantic_logger-4.5.0

- old
+ new

@@ -339,11 +339,11 @@ # Single parameter is a hash if params.empty? && message.is_a?(Hash) params = message message = nil end - start = Time.now + start = Process.clock_gettime(Process::CLOCK_MONOTONIC) begin if block_given? result = if (silence_level = params[:silence]) # In case someone accidentally sets `silence: true` instead of `silence: :error` @@ -360,11 +360,11 @@ log = Log.new(name, level, index) exception ||= params[:exception] message = params[:message] if params[:message] duration = if block_given? - 1000.0 * (Time.now - start) + 1_000.0 * (Process.clock_gettime(Process::CLOCK_MONOTONIC) - start) else params[:duration] || raise('Mandatory block missing when :duration option is not supplied') end # Extract options after block completes so that block can modify any of the options @@ -399,11 +399,11 @@ log_exception:, on_exception_level:) # Ignores filter, silence, payload exception = nil - start = Time.now + start = Process.clock_gettime(Process::CLOCK_MONOTONIC) begin yield rescue Exception => exc exception = exc ensure @@ -412,10 +412,10 @@ should_log = log.assign( message: message, min_duration: min_duration, exception: exception, metric: metric, - duration: 1000.0 * (Time.now - start), + duration: 1_000.0 * (Process.clock_gettime(Process::CLOCK_MONOTONIC) - start), log_exception: log_exception, on_exception_level: on_exception_level ) # Log level may change during assign due to :on_exception_level