vortos / vortos-logger
Vortos logger — Monolog PSR-3 integration
Requires
- php: >=8.2
- monolog/monolog: ^3.0
- psr/log: ^3.0
- vortos/vortos-foundation: ^1.0
- vortos/vortos-observability: ^1.0
Suggests
- sentry/sentry: Required for Sentry alerting handler (VortosLoggingConfig::sentry())
- vortos/vortos-tracing: Required for trace ID correlation in log records
- dev-main
- v1.0.0-alpha-91
- v1.0.0-alpha-90
- v1.0.0-alpha-89
- v1.0.0-alpha-86
- v1.0.0-alpha-85
- v1.0.0-alpha-80
- v1.0.0-alpha-78
- v1.0.0-alpha-76
- v1.0.0-alpha-75
- v1.0.0-alpha-74
- v1.0.0-alpha-72
- v1.0.0-alpha-71
- v1.0.0-alpha-70
- v1.0.0-alpha-69
- v1.0.0-alpha-68
- v1.0.0-alpha-67
- v1.0.0-alpha-66
- v1.0.0-alpha-65
- v1.0.0-alpha-64
- v1.0.0-alpha-63
- v1.0.0-alpha-62
- v1.0.0-alpha-61
- v1.0.0-alpha-60
- v1.0.0-alpha-59
- v1.0.0-alpha-58
- v1.0.0-alpha-57
- v1.0.0-alpha-56
- v1.0.0-alpha-55
- v1.0.0-alpha-54
- v1.0.0-alpha-53
- v1.0.0-alpha-52
- v1.0.0-alpha-51
- v1.0.0-alpha-50
- v1.0.0-alpha-49
- v1.0.0-alpha-47
- v1.0.0-alpha-46
- v1.0.0-alpha-45
- v1.0.0-alpha-44
- v1.0.0-alpha-43
- v1.0.0-alpha-42
- v1.0.0-alpha-40
- v1.0.0-alpha-39
- v1.0.0-alpha-38
- v1.0.0-alpha-37
- v1.0.0-alpha-36
- v1.0.0-alpha-34
- v1.0.0-alpha-33
- v1.0.0-alpha-31
- v1.0.0-alpha-30
- v1.0.0-alpha-29
- v1.0.0-alpha-28
- v1.0.0-alpha-27
- v1.0.0-alpha-26
- v1.0.0-alpha-25
- v1.0.0-alpha-24
- v1.0.0-alpha-23
- v1.0.0-alpha-22
- v1.0.0-alpha-21
- v1.0.0-alpha-20
- v1.0.0-alpha-18
- v1.0.0-alpha-17
- v1.0.0-alpha-16
- v1.0.0-alpha-15
- v1.0.0-alpha-14
- v1.0.0-alpha-13
- v1.0.0-alpha-12
- v1.0.0-alpha-11
- v1.0.0-alpha-9
- v1.0.0-alpha-8
- v1.0.0-alpha-7
- v1.0.0-alpha-6
- v1.0.0-alpha-5
- v1.0.0-alpha-4
- v1.0.0-alpha-3
- v1.0.0-alpha-2
- v1.0.0-alpha
This package is auto-updated.
Last update: 2026-05-14 19:15:53 UTC
README
The logger module provides PSR-3/Monolog logging with secure production defaults and explicit enterprise controls.
Defaults
app,http,cqrs,messaging,cache,security, andquerychannels are registered.- Production logs are JSON records on stderr.
- Development logs use local rotating files.
- Log buffering is enabled and flushed at HTTP terminate, console terminate, and console error events.
- Trace correlation is enabled when the tracing module is present.
- Sensitive keys are redacted from
contextandextra. - Structured fields are attached:
service.name,service.version,deployment.environment,event.dataset, andlog.logger. - Request context is bounded to method, path, client address, user agent, tenant id, and user id.
- Introspection is enabled only in
dev; it is disabled outsidedevto avoid source path leakage and extra stack work.
Configuration
use Monolog\Level; use Vortos\Logger\Config\LogChannel; use Vortos\Logger\DependencyInjection\VortosLoggingConfig; return static function (VortosLoggingConfig $config): void { $config ->service( name: $_ENV['OTEL_SERVICE_NAME'] ?? $_ENV['APP_NAME'] ?? 'checkout-api', version: $_ENV['APP_VERSION'] ?? '', environment: $_ENV['APP_ENV'] ?? 'prod', ) ->redaction(true, keys: ['card_number', 'billing_address']) ->structured(true) ->requestContext(true) ->correlationId(true) ->buffer(true) ->channel(LogChannel::Security, Level::Warning); };
Redaction
Redaction is enabled by default for common auth and PII keys such as password, token, authorization, api_key, email, phone, and ssn.
Add domain-specific keys with redaction(true, keys: [...]). Redaction is recursive with a bounded depth, so large or cyclic payloads do not create unbounded work.
Do not log request bodies, full headers, payment data, access tokens, refresh tokens, or raw identity provider payloads. Prefer stable ids and event names.
Alert Sinks
Sentry is supported as an error sink. If Sentry is configured but sentry/sentry is not installed, container compilation fails by default. This prevents a production deployment that appears configured but silently drops incidents.
Slack and email handlers are synchronous emergency sinks. Keep their minimum level high, such as Critical, and use Sentry, OpenTelemetry logs, or centralized log aggregation for primary production alerting.
$config->sentry(dsn: $_ENV['SENTRY_DSN'] ?? '', minLevel: Level::Error); $config->slack(webhook: $_ENV['SLACK_LOG_WEBHOOK'] ?? '', minLevel: Level::Critical); $config->email(to: $_ENV['LOG_ALERT_EMAIL'] ?? '', minLevel: Level::Critical);
Set failOnMissingIntegrations(false) only in local prototypes.