File tree Expand file tree Collapse file tree 3 files changed +11
-2
lines changed
lib/rails_semantic_logger Expand file tree Collapse file tree 3 files changed +11
-2
lines changed Original file line number Diff line number Diff line change @@ -42,7 +42,7 @@ def sql(event)
42
42
43
43
# Log the location of the query itself.
44
44
if logger . send ( :level_index ) >= SemanticLogger . backtrace_level_index
45
- log [ :backtrace ] = SemanticLogger ::Utils . strip_backtrace
45
+ log [ :backtrace ] = SemanticLogger ::Utils . strip_backtrace ( caller )
46
46
end
47
47
48
48
logger . debug ( log )
Original file line number Diff line number Diff line change @@ -214,6 +214,15 @@ class Engine < ::Rails::Engine
214
214
215
215
# Re-open appenders after Spring has forked a process
216
216
Spring . after_fork { |_job | ::SemanticLogger . reopen } if defined? ( Spring . after_fork )
217
+
218
+ console do |_app |
219
+ # Don't use a background thread for logging
220
+ SemanticLogger . sync!
221
+ SemanticLogger . add_appender ( io : STDERR , formatter : :color )
222
+
223
+ # Include method names on log entries in the console
224
+ SemanticLogger . backtrace_level = SemanticLogger . default_level
225
+ end
217
226
end
218
227
end
219
228
end
Original file line number Diff line number Diff line change @@ -16,5 +16,5 @@ Gem::Specification.new do |spec|
16
16
spec . required_ruby_version = ">= 2.3"
17
17
spec . add_dependency "rack"
18
18
spec . add_dependency "railties" , ">= 3.2"
19
- spec . add_dependency "semantic_logger" , "~> 4.4 "
19
+ spec . add_dependency "semantic_logger" , "~> 4.8 "
20
20
end
You can’t perform that action at this time.
0 commit comments