Class: Legion::Data::Connection::SlowQueryLogger

Inherits:
Object
  • Object
show all
Defined in:
lib/legion/data/connection.rb

Overview

Wraps a tagged Legion::Logging::Logger for Sequel’s logger interface. Prefixes warn-level messages with [slow-query] since Sequel uses warn for queries exceeding log_warn_duration.

Instance Method Summary collapse

Constructor Details

#initialize(tagged_logger) ⇒ SlowQueryLogger

Returns a new instance of SlowQueryLogger.



14
15
16
# File 'lib/legion/data/connection.rb', line 14

def initialize(tagged_logger)
  @tagged = tagged_logger
end

Instance Method Details

#debug(message) ⇒ Object



26
27
28
# File 'lib/legion/data/connection.rb', line 26

def debug(message)
  @tagged.debug(message)
end

#error(message) ⇒ Object



30
31
32
# File 'lib/legion/data/connection.rb', line 30

def error(message)
  @tagged.error(message)
end

#info(message) ⇒ Object



22
23
24
# File 'lib/legion/data/connection.rb', line 22

def info(message)
  @tagged.info(message)
end

#warn(message) ⇒ Object



18
19
20
# File 'lib/legion/data/connection.rb', line 18

def warn(message)
  @tagged.warn("[slow-query] #{message}")
end