Repository navigation
LogEventSanitizer
Pair\Core\LogEventSanitizer prepares log-event payloads before they are stored in LogEvent.
It is used by DatabaseLogWriter and by the LogEvent model lifecycle to keep database log records bounded and safer to inspect.
The sanitizer redacts sensitive keys such as:
authorizationcookie-
passwordandpasswd secrettoken-
apiKeyandapi_key passphrasecsrfsession
It also converts unsupported values into safe scalar descriptions and handles Throwable values without serializing the whole object.
To avoid oversized log rows, the sanitizer caps:
- nesting depth;
- number of array/object entries;
- scalar string length.
Nested values beyond the configured limits are replaced with compact placeholders.
server() keeps only selected request/server metadata that is useful for diagnostics and avoids raw cookie or authorization values.
The default log record already stores first-class fields such as request method, client IP, user agent, and referer. serverData is an additional bounded diagnostic payload, not a full dump of $_SERVER.
The sanitizer is a last-mile protection layer. Application code should still avoid logging credentials, tokens, full payment data, or unnecessary personal data in the first place.
See also: DatabaseLogWriter, LogEvent, ErrorLog, Logger.
Maintained by Viames Marino — VM Ingegneria · Professional enquiries
Home · Setup · Configuration
Build with Pair 4
- Generator
- Controllers and responses
- Read models
- ActiveRecord and queries
- Forms and validation
- PairUI.js, PairMotion.js and HTML fragments
APIs and authentication
- API guide and CRUD
- Middleware and rate limits
- Users, sessions, and ACL
- Passkeys and social login
- Native mobile setup
Integrate and operate
- Integrations
- Runtime extensions and adapter keys
- Cache and cache stores
- Logs and observability
- PWA and push
- Packages and distribution
- Upgrade to v4