How ayaou/command-logger-bundle works
Command Logger Bundle observes selected Symfony console command executions and records their arguments, timing, outcomes, errors, and optionally bounded output. The main flow runs from command lifecycle events through selection, tracking, redaction/capture, and persistence. Operators can query logs and statistics through console commands or a JSON-LD API; configuration also supports a separate Doctrine entity manager. Core listener and storage links are grounded in the source index and excerpts. Some command and listener implementations were not excerpted, so their documented capabilities are shown without speculative internal links.
Main entry points: CommandStartListener.php Start listener · CommandLogWriter.php Log writer · CommandTerminateListener.php Terminate listener · CommandLogController.php Log API controller
Components 27
Command lifecycle
- Start listener
src/EventListener/CommandLogger/CommandStartListener.php - Error listener
src/EventListener/CommandLogger/CommandErrorListener.php - Terminate listener
src/EventListener/CommandLogger/CommandTerminateListener.php - Command selection
src/Util/SupportedCommandResolver.php - Execution tracker
src/Util/CommandExecutionTracker.php
Log recording
- Parameter redaction
src/Util/SensitiveParameterRedactor.php - Output capture
src/Util/OutputCapture.php - Bounded output buffer
src/Util/OutputBuffer.php - Stream filter
src/Util/OutputCaptureFilter.php - Log writer
src/Util/CommandLogWriter.php - Command log entity
src/Entity/CommandLog.php - Doctrine database
Log access
- Query filters
src/Dto/CommandLogFilter.php - Log repository
src/Repository/CommandLogRepository.php - Statistics
src/Repository/CommandLogStatistics.php - Show log command
src/Command/ShowCommandLoggerEntriesCommand.php - Statistics command
src/Command/CommandLoggerStatisticsCommand.php - Purge command
src/Command/PurgeCommandLoggerTableCommand.php - Log API controller
src/Controller/Api/CommandLogController.php - JSON-LD responses
src/Service/JsonLdFactory.php
Bundle configuration
- Logger attribute
src/Attribute/CommandLogger.php - Command compiler pass
src/DependencyInjection/Compiler/CommandLoggerPass.php - Bundle extension
src/DependencyInjection/CommandLoggerExtension.php - Logger configuration
src/DependencyInjection/Configuration.php - Bundle registration
src/CommandLoggerBundle.php
Other components
- Symfony command
- API client
Connections 35
- Symfony command → Start listener: starts event
README.md - Symfony command → Error listener: error event
README.md - Symfony command → Terminate listener: terminates event
README.md - Start listener → Command selection: checks support
src/EventListener/CommandLogger/CommandStartListener.php - Error listener → Command selection: checks support
src/EventListener/CommandLogger/CommandErrorListener.php - Terminate listener → Command selection: checks support
src/EventListener/CommandLogger/CommandTerminateListener.php - Start listener → Execution tracker: records execution
src/EventListener/CommandLogger/CommandStartListener.php - Error listener → Execution tracker: retrieves execution
src/EventListener/CommandLogger/CommandErrorListener.php - Terminate listener → Execution tracker: retrieves timing
src/EventListener/CommandLogger/CommandTerminateListener.php - Start listener → Parameter redaction: redacts arguments
src/EventListener/CommandLogger/CommandStartListener.php - Start listener → Output capture: starts capture
src/EventListener/CommandLogger/CommandStartListener.php - Terminate listener → Output capture: stops capture
src/EventListener/CommandLogger/CommandTerminateListener.php - Output capture → Bounded output buffer: appends output
src/Util/OutputCapture.php - Output capture → Stream filter: attaches filter
src/Util/OutputCapture.php - Start listener → Log writer: creates log
src/EventListener/CommandLogger/CommandStartListener.php - Error listener → Log writer: records failure
src/EventListener/CommandLogger/CommandErrorListener.php - Terminate listener → Log writer: records outcome
src/EventListener/CommandLogger/CommandTerminateListener.php - Log writer → Command log entity: maps fields
src/Util/CommandLogWriter.php - Log writer → Doctrine database: writes rows
src/Util/CommandLogWriter.php - Command log entity → Doctrine database: stored as
src/Entity/CommandLog.php - Show log command → Query filters: accepts filters
src/Command/ShowCommandLoggerEntriesCommand.php - Show log command → Log repository: queries logs
src/Command/ShowCommandLoggerEntriesCommand.php - Statistics command → Query filters: accepts filters
src/Command/CommandLoggerStatisticsCommand.php - Statistics command → Statistics: requests metrics
src/Command/CommandLoggerStatisticsCommand.php - Purge command → Log repository: deletes old logs
src/Command/PurgeCommandLoggerTableCommand.php - Log API controller → Query filters: accepts filters
src/Controller/Api/CommandLogController.php - Log API controller → Log repository: queries logs
src/Controller/Api/CommandLogController.php - Log API controller → Statistics: requests metrics
src/Controller/Api/CommandLogController.php - Log API controller → JSON-LD responses: builds responses
src/Controller/Api/CommandLogController.php - API client → Log API controller: requests logs
README.md - Logger attribute → Command compiler pass: detected at build
src/DependencyInjection/Compiler/CommandLoggerPass.php - Bundle registration → Command compiler pass: registers pass
src/CommandLoggerBundle.php - Bundle extension → Logger configuration: loads configuration
src/DependencyInjection/CommandLoggerExtension.php - Logger configuration → Log writer: configures manager
README.md - Logger configuration → Output capture: configures capture
README.md