Class: PromptSanitizer::Audit::Base
- Inherits:
-
Object
- Object
- PromptSanitizer::Audit::Base
- Defined in:
- lib/prompt_sanitizer/audit/base.rb
Overview
Abstract base class for audit log backends.
Subclass and implement record, export, count, and clear.
Example custom backend:
class MyAuditLog < PromptSanitizer::Audit::Base
def record(event) = MyDB.insert(event.to_h)
def export(format: :json, since: nil, session_id: nil) = "..."
def count(since: nil) = MyDB.count
def clear = MyDB.truncate
end
Direct Known Subclasses
Instance Method Summary collapse
-
#clear ⇒ Object
Remove all stored events.
-
#count(since: nil) ⇒ Integer
Count matching events.
-
#export(format: :json, since: nil, session_id: nil) ⇒ String
Export events as a formatted string.
-
#record(_event) ⇒ Object
Record a detection event.
Instance Method Details
#clear ⇒ Object
Remove all stored events.
100 101 102 |
# File 'lib/prompt_sanitizer/audit/base.rb', line 100 def clear raise NotImplementedError, "#{self.class}#clear is not implemented" end |
#count(since: nil) ⇒ Integer
Count matching events.
95 96 97 |
# File 'lib/prompt_sanitizer/audit/base.rb', line 95 def count(since: nil) raise NotImplementedError, "#{self.class}#count is not implemented" end |
#export(format: :json, since: nil, session_id: nil) ⇒ String
Export events as a formatted string.
88 89 90 |
# File 'lib/prompt_sanitizer/audit/base.rb', line 88 def export(format: :json, since: nil, session_id: nil) raise NotImplementedError, "#{self.class}#export is not implemented" end |
#record(_event) ⇒ Object
Record a detection event. Must not store the original PII value.
79 80 81 |
# File 'lib/prompt_sanitizer/audit/base.rb', line 79 def record(_event) raise NotImplementedError, "#{self.class}#record is not implemented" end |