lib/semantic_logger/base.rb in semantic_logger-4.7.4 vs lib/semantic_logger/base.rb in semantic_logger-4.8.0
- old
+ new
@@ -61,11 +61,11 @@
#
# # Enable trace level logging
# SemanticLogger.default_level = :info
#
# # Log to screen
- # SemanticLogger.add_appender(io: STDOUT, formatter: :color)
+ # SemanticLogger.add_appender(io: $stdout, formatter: :color)
#
# # And log to a file at the same time
# SemanticLogger.add_appender(file_name: 'application.log', formatter: :color)
#
# logger = SemanticLogger['MyApplication']
@@ -134,11 +134,11 @@
log = Log.new(name, level)
return false unless meets_log_level?(log)
backtrace =
if thread == Thread.current
- Utils.extract_backtrace
+ Utils.extract_backtrace(caller)
else
log.thread_name = thread.name
log.tags = (thread[:semantic_logger_tags] || []).clone
log.named_tags = (thread[:semantic_logger_named_tags] || {}).clone
thread.backtrace
@@ -374,10 +374,10 @@
end
rescue Exception => e
exception = e
ensure
# Must use ensure block otherwise a `return` in the yield above will skip the log entry
- log = Log.new(name, level, index)
+ log = Log.new(name, level, index)
exception ||= params[:exception]
message = params[:message] if params[:message]
duration =
if block_given?
1_000.0 * (Process.clock_gettime(Process::CLOCK_MONOTONIC) - start)