Class: QueryTrack::Notifications::Log

Inherits:
Object
  • Object
show all
Defined in:
lib/query_track/notifications/log.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(code, duration) ⇒ Log

Returns a new instance of Log.



6
7
8
9
# File 'lib/query_track/notifications/log.rb', line 6

def initialize(code, duration)
  @code = code.strip
  @duration = duration
end

Instance Attribute Details

#codeObject (readonly)

Returns the value of attribute code.



4
5
6
# File 'lib/query_track/notifications/log.rb', line 4

def code
  @code
end

#durationObject (readonly)

Returns the value of attribute duration.



4
5
6
# File 'lib/query_track/notifications/log.rb', line 4

def duration
  @duration
end

#webhook_urlObject (readonly)

Returns the value of attribute webhook_url.



4
5
6
# File 'lib/query_track/notifications/log.rb', line 4

def webhook_url
  @webhook_url
end

Instance Method Details

#callObject



11
12
13
14
15
16
17
# File 'lib/query_track/notifications/log.rb', line 11

def call
  return unless QueryTrack::Settings.config.logs

  trace = QueryTrack::Trace.new(caller).call

  QueryTrack.logger.info "\n#{code}\nDuration: #{duration}s\nTrace: #{trace}"
end