Class: SoarAuditingProvider::AuditingProvider
- Inherits:
-
SoarAuditingProviderAPI::AuditingProviderAPI
- Object
- SoarAuditingProviderAPI::AuditingProviderAPI
- SoarAuditingProvider::AuditingProvider
- Defined in:
- lib/soar_auditing_provider/auditing_provider.rb
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
- #<<(data, flow_identifier = nil) ⇒ Object
- #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
-
#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.
24 25 26 27 28 29 30 31 32 33 |
# File 'lib/soar_auditing_provider/auditing_provider.rb', line 24 def initialize(configuration) validate_provider_configuration(configuration) @configuration = configuration 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.
22 23 24 |
# File 'lib/soar_auditing_provider/auditing_provider.rb', line 22 def configuration @configuration end |
#service_identifier ⇒ Object
Returns the value of attribute service_identifier.
21 22 23 |
# File 'lib/soar_auditing_provider/auditing_provider.rb', line 21 def service_identifier @service_identifier end |
#startup_flow_id ⇒ Object
Returns the value of attribute startup_flow_id.
20 21 22 |
# File 'lib/soar_auditing_provider/auditing_provider.rb', line 20 def startup_flow_id @startup_flow_id end |
Instance Method Details
#<<(data, flow_identifier = nil) ⇒ Object
67 68 69 |
# File 'lib/soar_auditing_provider/auditing_provider.rb', line 67 def <<(data, flow_identifier = nil) audit(:info, format(:info, prepend_caller_information(data), flow_identifier)) end |
#audit_exception(exception:, level: :error, flow_id: nil, message: nil) ⇒ Object
81 82 83 84 85 86 87 |
# File 'lib/soar_auditing_provider/auditing_provider.rb', line 81 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
47 48 49 |
# File 'lib/soar_auditing_provider/auditing_provider.rb', line 47 def debug(data, flow_identifier = nil) audit(:debug, format(:debug, prepend_caller_information(data), flow_identifier)) end |
#detailed_status ⇒ Object
71 72 73 74 75 |
# File 'lib/soar_auditing_provider/auditing_provider.rb', line 71 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
59 60 61 |
# File 'lib/soar_auditing_provider/auditing_provider.rb', line 59 def error(data, flow_identifier = nil) audit(:error, format(:error, prepend_caller_information(data), flow_identifier)) end |
#fatal(data, flow_identifier = nil) ⇒ Object
63 64 65 |
# File 'lib/soar_auditing_provider/auditing_provider.rb', line 63 def fatal(data, flow_identifier = nil) audit(:fatal, format(:fatal, prepend_caller_information(data), flow_identifier)) end |
#flush(timeout: 1) ⇒ Object
77 78 79 |
# File 'lib/soar_auditing_provider/auditing_provider.rb', line 77 def flush(timeout: 1) @worker.flush(timeout: timeout) end |
#info(data, flow_identifier = nil) ⇒ Object
51 52 53 |
# File 'lib/soar_auditing_provider/auditing_provider.rb', line 51 def info(data, flow_identifier = nil) audit(:info, format(:info, prepend_caller_information(data), flow_identifier)) end |
#select_auditor(nfrs) ⇒ Object
35 36 37 38 |
# File 'lib/soar_auditing_provider/auditing_provider.rb', line 35 def select_auditor(nfrs) select(nfrs) set_audit_level(@configuration['level'].to_sym) end |
#set_audit_level(level) ⇒ Object
40 41 42 43 44 45 |
# File 'lib/soar_auditing_provider/auditing_provider.rb', line 40 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
55 56 57 |
# File 'lib/soar_auditing_provider/auditing_provider.rb', line 55 def warn(data, flow_identifier = nil) audit(:warn, format(:warn, prepend_caller_information(data), flow_identifier)) end |