5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
|
# File 'lib/queries_watch/helpers.rb', line 5
def queries_watch_summary
summary = Current.summary
messaage = "%c[Queries] %ctotal_count: #{summary.total_count}, cached_count: #{summary.cached_count}, exec_count: #{summary.exec_count}, total_duration: #{summary.total_duration}"
logs = Current.logs.map do |log|
log.merge(duration: log[:duration].round(2))
end
javascript_tag <<~JS
if (console && console.groupCollapsed) {
console.#{Current.level}('#{messaage}', 'font-weight: bold', '')
console.groupCollapsed()
console.table(#{logs.to_json})
console.groupEnd()
}
JS
end
|