class Gn::Tracker

Constants

VERSION

Attributes

configuration[W]

Public Class Methods

configuration() click to toggle source
# File lib/gn/tracker.rb, line 9
def configuration
  @configuration ||= Configuration.new
end
configure() { |configuration| ... } click to toggle source
# File lib/gn/tracker.rb, line 14
def self.configure
  yield(configuration)
end
new() click to toggle source
# File lib/gn/tracker.rb, line 18
def initialize
  @logger = LogStashLogger.new(
    type: :file,
    sync: true,
    path: self.class.configuration.path
  )
end

Public Instance Methods

track_unstruct_event( message:, schema:, application: self.class.configuration.application, true_timestamp: DateTime.now.strftime('%Q'), contexts: [] ) click to toggle source
# File lib/gn/tracker.rb, line 26
def track_unstruct_event(
  message:,
  schema:,
  application: self.class.configuration.application,
  true_timestamp: DateTime.now.strftime('%Q'),
  contexts: []
)
  event = LogStash::Event.new(
    message: message.to_json,
    application: application,
    schema: schema,
    true_timestamp: true_timestamp,
    contexts: contexts.to_json
  )
  @logger.info event
end