Sha256: ee698d1b50e9e4174850fd8b37a1469e25727d776bdb638101ef591a04f4653f

Contents?: true

Size: 534 Bytes

Versions: 6

Compression:

Stored size: 534 Bytes

Contents

# Logs DB queries in console
# to active just load the file
if Lux.config(:log_to_stdout)
  logger = Logger.new(STDOUT)

  logger.formatter = proc { |severity, datetime, progname, msg|
    elms = msg.split(/\(|s\)\s/, 3)
    time = (elms[1].to_f * 1000).round(1)

    if c = Thread.current[:db_q]
      if c && c[:last] != msg
        c[:last] = msg
        c[:time] += elms[1].to_f
        c[:cnt]  += 1

        Lux.log " #{c[:cnt].to_s.rjust(2)}. #{time} : #{elms[2].to_s.cyan}\n"
      end
    end
  }

  DB.loggers << logger
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
lux-fw-0.5.37 ./plugins/db/logger/config.rb
lux-fw-0.5.36 ./plugins/db/logger/config.rb
lux-fw-0.5.35 ./plugins/db/logger/config.rb
lux-fw-0.5.34 ./plugins/db/logger/config.rb
lux-fw-0.5.33 ./plugins/db/logger/config.rb
lux-fw-0.5.32 ./plugins/db/logger/config.rb