Skip to content

Commit f4cbc78

Browse files
committed
update readme
1 parent 5291a7a commit f4cbc78

File tree

1 file changed

+22
-0
lines changed

1 file changed

+22
-0
lines changed

README.md

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff 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)

0 commit comments

Comments
 (0)