Class: SoarAuditingProvider::AuditingProvider
- Inherits:
-
SoarAuditingProviderAPI::AuditingProviderAPI
- Object
- SoarAuditingProviderAPI::AuditingProviderAPI
- SoarAuditingProvider::AuditingProvider
- Defined in:
- lib/soar_auditing_provider/auditing_provider.rb
Constant Summary collapse
- DEFAULT_FLOW_ID_GENERATOR =
-> { SoarFlow::ID::generate_flow_id }
Instance Attribute Summary collapse
-
#configuration ⇒ Object
readonly
Returns the value of attribute configuration.
-
#service_identifier ⇒ Object
Returns the value of attribute service_identifier.
-
#startup_flow_id ⇒ Object
Returns the value of attribute startup_flow_id.
Instance Method Summary collapse
- #audit_exception(exception:, level: :error, flow_id: nil, message: nil) ⇒ Object
- #debug(data, flow_identifier = nil) ⇒ Object
- #detailed_status ⇒ Object
- #error(data, flow_identifier = nil) ⇒ Object
- #fatal(data, flow_identifier = nil) ⇒ Object
- #flush(timeout: 1) ⇒ Object
- #info(data, flow_identifier = nil) ⇒ Object (also: #<<)
-
#initialize(configuration) ⇒ AuditingProvider
constructor
A new instance of AuditingProvider.
- #select_auditor(nfrs) ⇒ Object
- #set_audit_level(level) ⇒ Object
- #warn(data, flow_identifier = nil) ⇒ Object
Constructor Details
#initialize(configuration) ⇒ AuditingProvider
Returns a new instance of AuditingProvider.
27 28 29 30 31 32 33 34 35 36 37 |
# File 'lib/soar_auditing_provider/auditing_provider.rb', line 27 def initialize(configuration) validate_provider_configuration(configuration) @configuration = configuration @flow_id_generator = @configuration["flow_id_generator"] || DEFAULT_FLOW_ID_GENERATOR super(create_auditors(configuration)) select_auditor(configuration['default_nfrs']) create_auditing_worker @buffer_overflow_count = 0 install_at_exit_handler initialize_metrics end |
Instance Attribute Details
#configuration ⇒ Object (readonly)
Returns the value of attribute configuration.
25 26 27 |
# File 'lib/soar_auditing_provider/auditing_provider.rb', line 25 def configuration @configuration end |
#service_identifier ⇒ Object
Returns the value of attribute service_identifier.
24 25 26 |
# File 'lib/soar_auditing_provider/auditing_provider.rb', line 24 def service_identifier @service_identifier end |
#startup_flow_id ⇒ Object
Returns the value of attribute startup_flow_id.
23 24 25 |
# File 'lib/soar_auditing_provider/auditing_provider.rb', line 23 def startup_flow_id @startup_flow_id end |
Instance Method Details
#audit_exception(exception:, level: :error, flow_id: nil, message: nil) ⇒ Object
83 84 85 86 87 88 89 |
# File 'lib/soar_auditing_provider/auditing_provider.rb', line 83 def audit_exception(exception:, level: :error, flow_id: nil, message: nil) = "#{exception.class}: #{exception.}" = "#{} - #{}" if = + ":\n\t" + exception.backtrace.join("\n\t") if ENV['RACK_ENV'] == 'development' level = :error if not is_valid_audit_level?(level) send(level,,flow_id) end |
#debug(data, flow_identifier = nil) ⇒ Object
51 52 53 |
# File 'lib/soar_auditing_provider/auditing_provider.rb', line 51 def debug(data, flow_identifier = nil) audit(:debug, data, flow_identifier) end |
#detailed_status ⇒ Object
73 74 75 76 77 |
# File 'lib/soar_auditing_provider/auditing_provider.rb', line 73 def detailed_status detail = basic_status_detail detail = detail.merge(verbose_status_detail) if @configuration['verbose_detail'] detail end |
#error(data, flow_identifier = nil) ⇒ Object
65 66 67 |
# File 'lib/soar_auditing_provider/auditing_provider.rb', line 65 def error(data, flow_identifier = nil) audit(:error, data, flow_identifier) end |
#fatal(data, flow_identifier = nil) ⇒ Object
69 70 71 |
# File 'lib/soar_auditing_provider/auditing_provider.rb', line 69 def fatal(data, flow_identifier = nil) audit(:fatal, data, flow_identifier) end |
#flush(timeout: 1) ⇒ Object
79 80 81 |
# File 'lib/soar_auditing_provider/auditing_provider.rb', line 79 def flush(timeout: 1) @worker.flush(timeout: timeout) end |
#info(data, flow_identifier = nil) ⇒ Object Also known as: <<
55 56 57 |
# File 'lib/soar_auditing_provider/auditing_provider.rb', line 55 def info(data, flow_identifier = nil) audit(:info, data, flow_identifier) end |
#select_auditor(nfrs) ⇒ Object
39 40 41 42 |
# File 'lib/soar_auditing_provider/auditing_provider.rb', line 39 def select_auditor(nfrs) select(nfrs) set_audit_level(@configuration['level'].to_sym) end |
#set_audit_level(level) ⇒ Object
44 45 46 47 48 49 |
# File 'lib/soar_auditing_provider/auditing_provider.rb', line 44 def set_audit_level(level) @auditor.set_audit_level(level) rescue ArgumentError $stderr.puts 'Invalid auditing level' raise end |
#warn(data, flow_identifier = nil) ⇒ Object
61 62 63 |
# File 'lib/soar_auditing_provider/auditing_provider.rb', line 61 def warn(data, flow_identifier = nil) audit(:warn, data, flow_identifier) end |