Skip to content

docs(dev): overhaul logging chapter for accuracy and completeness#14187

Open
joshtrichards wants to merge 1 commit intomasterfrom
jtr/docs-dev-logging-v34
Open

docs(dev): overhaul logging chapter for accuracy and completeness#14187
joshtrichards wants to merge 1 commit intomasterfrom
jtr/docs-dev-logging-v34

Conversation

@joshtrichards
Copy link
Copy Markdown
Member

@joshtrichards joshtrichards commented Apr 1, 2026

☑️ Resolves

The previous logging documentation was minimal, contained outdated examples, and omitted significant functionality. This rewrite brings the chapter in line with the current implementation (on the dev-side).

Changes

  • Modernized Examples: Updated the basic usage example to use constructor promotion, removed the unused $appName injection, and explained ScopedPsrLogger auto-scoping.
  • PSR-3 Support: Added a reference for all eight log methods, documented message interpolation ({placeholder} syntax), and added a PSR-3 to Nextcloud numeric level mapping table.
  • Context & Exceptions: Clarified context array special keys (exception, app) and added a dedicated section on logging exceptions via context['exception'].
  • Advanced Logging: Documented ILogFactory::getCustomPsrLogger() for custom files and IDataLogger::logData() for structured data.
  • Events & Security: Documented BeforeMessageLoggedEvent for listening to log writes and obfuscateParameters for CriticalActionPerformedEvent.

🖼️ Screenshots

…pleteness

The existing logging chapter was minimal, contained a misleading code example, and omitted most of the functionality available to app developers. This rewrite brings the documentation in line with the actual implementation.

Changes:
- Fix basic usage example: remove unused $appName injection, modernize to constructor promotion, explain ScopedPsrLogger auto-scoping
- Add section listing all eight PSR-3 log methods
- Add log level mapping table (PSR-3 to Nextcloud numeric levels)
- Document PSR-3 message interpolation ({placeholder} syntax)
- Document context array special keys (exception, app) and clarify that arbitrary keys are passed through as extra data
- Add dedicated section on exception logging via context['exception']
- Document ILogFactory::getCustomPsrLogger() for custom log files
- Document IDataLogger::logData() for structured data logging
- Document BeforeMessageLoggedEvent for listening to log writes
- Document obfuscateParameters on CriticalActionPerformedEvent

Signed-off-by: Josh <josh.t.richards@gmail.com>
@joshtrichards joshtrichards added this to the Nextcloud 34 milestone Apr 1, 2026
@joshtrichards joshtrichards changed the title docs(developer_manual): overhaul logging chapter for accuracy and completeness docs(dev): overhaul logging chapter for accuracy and completeness Apr 1, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants