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.



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

def initialize(tagged_logger)
  @tagged = tagged_logger
end

Instance Method Details

#debug(message) ⇒ Object



43
44
45
# File 'lib/legion/data/connection.rb', line 43

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

#error(message) ⇒ Object



47
48
49
# File 'lib/legion/data/connection.rb', line 47

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

#info(message) ⇒ Object



39
40
41
# File 'lib/legion/data/connection.rb', line 39

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

#warn(message) ⇒ Object



35
36
37
# File 'lib/legion/data/connection.rb', line 35

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