File tree Expand file tree Collapse file tree 1 file changed +22
-0
lines changed
Expand file tree Collapse file tree 1 file changed +22
-0
lines changed Original file line number Diff line number Diff line change @@ -107,6 +107,28 @@ $data = json_repair_decode(
107107);
108108```
109109
110+ ## Logging
111+
112+ The library supports PSR-3 logging for debugging repair operations. Pass any PSR-3 compatible logger to see what repairs are being made:
113+
114+ ``` php
115+ use Psr\Log\LoggerInterface;
116+
117+ // Using the helper function
118+ $repaired = json_repair($broken, logger: $logger);
119+
120+ // Using the class (implements LoggerAwareInterface)
121+ $repairer = new JsonRepairer($broken);
122+ $repairer->setLogger($logger);
123+ $repaired = $repairer->repair();
124+ ```
125+
126+ Log messages include the position in the JSON string and a context snippet showing where the repair occurred. This is useful for:
127+
128+ - Debugging why certain repairs are being made
129+ - Understanding how malformed JSON is being interpreted
130+ - Tracking repair operations in production environments
131+
110132## Credits
111133
112134- [ Sean Tymon] ( https://github.com/tymondesigns )
You can’t perform that action at this time.
0 commit comments