mirror of
https://github.com/Seldaek/monolog.git
synced 2026-04-26 16:15:49 +03:00
[GH-ISSUE #1798] How to set other field into the LogRecord for V3 #760
Labels
No labels
Bug
Documentation
Feature
Needs Work
Support
pull-request
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
starred/monolog#760
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @yankewei on GitHub (Mar 30, 2023).
Original GitHub issue: https://github.com/Seldaek/monolog/issues/1798
Monolog version 1|2|3?
3
Write your question here.
In Monolog version 2, we could kindly call the
pushProcessormethod to add our custom processor, which gracefully adds some fields to the log. However, in version 3, the processor's callable has to respectfully accept a LogRecord object, and theLogRecordcan only have seven keys - "message", "context", "level", "channel", "datetime", and "extra". We cannot set other fields in the LogRecord object. May I kindly ask if you provide an alternative method that allows us to elegantly customize theLogRecordcontent?@Seldaek commented on GitHub (Jun 20, 2023):
processors were always meant to store data in the extra array, which is still available in monolog 3.