Sha256: f4ef841c22db63abf32dcaadc974f407f32bba52813eaa2dda72e1b562047dc3
Contents?: true
Size: 1.69 KB
Versions: 6
Compression:
Stored size: 1.69 KB
Contents
require 'active_support/notifications' require 'nexaas/auditor/version' require 'nexaas/auditor/configuration' require 'nexaas/auditor/subscriber' require 'nexaas/auditor/logs_subscriber' require 'nexaas/auditor/stats_subscriber' require 'nexaas/auditor/adapters/nunes' require 'nexaas/auditor/rails_subscriber' require 'nexaas/auditor/audit_logger' require 'nexaas/auditor/statistics_trackers/base' require 'nexaas/auditor/statistics_trackers/log' require 'nexaas/auditor/statistics_trackers/stathat' require 'nexaas/auditor/statistics_tracker' module Nexaas module Auditor extend SingleForwardable # forwards Nexaas::Auditor.instrument to ActiveSupport::Notifications.instrument single_delegate :instrument => ActiveSupport::Notifications class << self def configure # if configuration.enabled has not been set yet (is still 'nil'), set to true. configuration.enabled = true if configuration.enabled.nil? yield(configuration) end def configuration @configuration ||= Configuration.new end def logger Thread.current[:_nexaas_auditor_logger] ||= AuditLogger.new end def tracker Thread.current[:_nexaas_auditor_tracker] ||= StatisticsTracker.setup( configuration.statistics_service, configuration.statistics_namespace ) end def subscribe_all subscribers = [] subscribers << LogsSubscriber.subscribe_all if configuration.log_app_events subscribers << StatsSubscriber.subscribe_all if configuration.track_app_events subscribers << RailsSubscriber.subscribe_all if configuration.track_rails_events subscribers end end end end
Version data entries
6 entries across 6 versions & 1 rubygems