Class: Webhookdb::Async::AuditLogger
- Inherits:
-
Amigo::AuditLogger
- Object
- Amigo::AuditLogger
- Webhookdb::Async::AuditLogger
- Includes:
- Appydays::Loggable
- Defined in:
- lib/webhookdb/async/audit_logger.rb
Constant Summary collapse
- MAX_STR_LEN =
64
- STR_PREFIX_LEN =
12
Instance Method Summary collapse
- #audit_log_level ⇒ Object
- #perform(event_json) ⇒ Object
- #trim_long_strings(v, max_str_len:, str_prefix_len:) ⇒ Object
Instance Method Details
#audit_log_level ⇒ Object
14 |
# File 'lib/webhookdb/async/audit_logger.rb', line 14 def audit_log_level = Webhookdb::Async.audit_log_level |
#perform(event_json) ⇒ Object
16 17 18 19 20 |
# File 'lib/webhookdb/async/audit_logger.rb', line 16 def perform(event_json) j2 = event_json.dup j2["payload"] = self.trim_long_strings(j2["payload"], max_str_len: MAX_STR_LEN, str_prefix_len: STR_PREFIX_LEN) super(j2) end |
#trim_long_strings(v, max_str_len:, str_prefix_len:) ⇒ Object
22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 |
# File 'lib/webhookdb/async/audit_logger.rb', line 22 def trim_long_strings(v, max_str_len:, str_prefix_len:) case v when Hash v.transform_values do |hv| self.trim_long_strings(hv, max_str_len:, str_prefix_len:) end when Array v.map { |item| self.trim_long_strings(item, max_str_len:, str_prefix_len:) } when String if v.size > max_str_len v[..str_prefix_len] + "..." else v end else v end end |