You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
PHP dump logger uses [Symfony's var-dumper][link-symfony-var-dumper] to create a simple, easy to use, eye-friendly, and pretty log files for any PHP application.
43
-
If you are the fan of using `dd()` and `dump()`, this package is for you.
41
+
## Introduction <spanid="introduction"></span>
42
+
PHP dump logger uses [Symfony's var-dumper][link-symfony-var-dumper] to create a simple, easy to use, eye-friendly, and pretty log files for any PHP application.
43
+
If you are a fan of using `dd()` and `dump()`, this package is for you.
Have you ever tried to log something with Symfony's monolog or laravel's logger facade and tried to find the logged data inside a maze of text?
50
-
Specially when you don't have time and don't want to go through installing and configuring Xdebug or there is a bug in production code,
51
-
and you just want to see the API responses without messing with the code execution.
52
-
The first solution that comes to mind is to use a logger to log the data instead of using `dd()`, `dump()`, or `var_dump()` functions.
53
-
But as I said loggers aren't producing readable files. You have to provide them with string, and they are incapable of directly logging a complex class.
54
-
How nice could it be to have a functionality like `dd()` without interruption in the code.
50
+
Especially when you don't have time and don't want to go through installing and configuring Xdebug or there is a bug in production code,
51
+
and you just want to see the API responses without messing with the code execution.
52
+
The first solution that comes to mind is to use a logger to log the data instead of using `dd()`, `dump()`, or `var_dump()` functions.
53
+
But as I said, loggers aren't producing readable files. You have to provide them with a string, and they are incapable of directly logging a complex class.
54
+
How nice would it be to have a functionality like `dd()` without interruption in the code?
55
55
56
56
Here **php-dump-logger** comes to the rescue.
57
57
@@ -68,7 +68,7 @@ You can either log the data in a nice `html` or `log` format or even provide you
Sometimes you want to put your log files in a directory with restricted permission.
249
249
In order to do that you can change the log file's directory permission with the `permission()` method.
@@ -261,7 +261,7 @@ $logger->permission(0777);
261
261
262
262
<br/>
263
263
264
-
### Daily Log
264
+
### Daily Log <spanid="daily-log"></span>
265
265
266
266
Sometimes you want to log data daily into separate file's based on date, You can separate the log files daily with date suffix by calling the `daily()` method.
Calling `silent()` method allows you to log data without throwing an error.
289
+
Calling `silent()` method allows you to log data without throwing an error.
290
290
291
-
Remember that in some cases the logger will throw an error like when the $path is empty, or when it couldn't write into the target file for permission reasons.
291
+
Remember that in some cases the logger will throw an error like when the $path is empty, or when it couldn't write into the target file for permission reasons.
292
292
293
293
So if you want to avoid that, and you don't want to interrupt the code execution, you can call `silent()` method.
294
294
In the background this method will force the logger to execute the code in try-catch block and return a boolean instead of the exception.
@@ -301,15 +301,15 @@ $logger->silent(); //result will be true for success and false for failed attemp
301
301
302
302
<br/>
303
303
304
-
## Loggers
304
+
## Loggers <spanid="loggers"></span>
305
305
306
306
*[Pretty Logger](#pretty-logger)
307
307
*[Html Logger](#html-logger)
308
308
*[Raw Logger](#raw-logger)
309
309
*[Custom Logger](#custom-logger)
310
310
311
311
312
-
### Pretty Logger
312
+
### Pretty Logger <spanid="pretty-logger"></span>
313
313
314
314
The pretty logger is used for creating a log file with `.log` extension in a pretty readable way.
315
315
@@ -334,7 +334,7 @@ $logger = Logger::pretty();
334
334
335
335
<br/>
336
336
337
-
### Html Logger
337
+
### Html Logger <spanid="html-logger"></span>
338
338
339
339
The html logger is used for creating a log file with `.html` extension in a pretty readable way.
340
340
You can navigate throw different variables, toggle the multidimensional arrays and complex class properties.
@@ -356,10 +356,10 @@ $logger = Logger::html();
356
356
357
357
<br/>
358
358
359
-
### Raw Logger
359
+
### Raw Logger <spanid="raw-logger"></span>
360
360
361
361
Raw Logger is base logger class that other loggers are using it. The only difference between Raw Logger and the others is that there
362
-
is no dumper or path specified in this logger, and you have to provide a dumper and the file extension with `dumper()` and the path with `path()` method.
362
+
is no dumper or path specified in this logger, and you have to provide a dumper and the file extension with `dumper()` and the path with `path()` method.
363
363
Otherwise, it will throw `SaliBhdr\DumpLog\ExceptionsInvalidArgumentException`
364
364
365
365
Remember that the dumper should be the instance of `Symfony\Component\VarDumper\Dumper\AbstractDumper`.
You can create your own dump logger by implementing the `SaliBhdr\DumpLog\Contracts\DumpLoggerInterface` or `SaliBhdr\DumpLog\Contracts\ChangeableDumperLoggerInterface`.
389
389
You can also use the RawLogger in your own logger by first instantiating the RawLogger in your Logger and then use the `SaliBhdr\DumpLog\Traits\LogsThroughRawLogger` trait.
@@ -419,7 +419,7 @@ class CustomTextLogger implements DumpLoggerInterface
419
419
```
420
420
<br />
421
421
422
-
## Full Example
422
+
## Full Example <spanid="full-example"></span>
423
423
424
424
```php
425
425
<?php
@@ -436,11 +436,11 @@ Logger::make()
436
436
437
437
```
438
438
439
-
## Issues
439
+
## Issues <spanid="issues"></span>
440
440
441
441
You can report issues in GitHub repository [here][link-issues]
442
442
443
-
## License
443
+
## License <spanid="license"></span>
444
444
445
445
PHP dump logger is released under the MIT License.
446
446
@@ -457,7 +457,7 @@ Created by [Salar Bahador][link-github]
457
457
458
458
Built with ❤ for you.
459
459
460
-
## Testing
460
+
## Testing <spanid="testing"></span>
461
461
462
462
for testing:
463
463
@@ -477,17 +477,21 @@ for both csfix and test:
477
477
composer testfix
478
478
```
479
479
480
-
## Contributing
480
+
## Contributing <spanid="contributing"></span>
481
481
482
482
Please see [CONTRIBUTING](CONTRIBUTING.md) for details.
0 commit comments