Write Log – Laravel Package for Easy Debug of Variable
Write Log Laravel Package
Simplified logging for laravel application. You can use it to log your message, array, object, etc. Sometimes we need to see if the data is coming from the request or database without stopping the execution of the application. we can easily check by this package. A very common practice we found among laravel developer to use dd() function to debug any variable which actually stop’s the next line execution but if we manage a way we will put the variable’s value in a log file like we use laravel log package for error log(even log package can be used for var dump purpose for which we actually developed this package) then without killing the full execution we can check the variable output and same time the full page execution can happen.
So we are introducing a very simple and small but useful laravel package writelog
While working for api based laravel projects we always felt something like this and we released this small package for community so that others can use and get benefited. You are welcome to contribute to the package.
- PHP >=7.2
- Laravel >= 6
<code class="language-php">composer require codeboxr/writelog</code>
<code class="language-php"> use Codeboxr\Writelog\Facade\WriteLog WriteLog::log(['codeboxr','laravel']); </code>
or you can simply use our helper methods
<code class="language-php"> writelog(['codeboxr','laravel']); </code>
If you want to to edit your file path or file name you should publish config file by artisan command
<code class="language-php"> php artisan vendor:publish --provider="Codeboxr\Writelog\WriteLogServiceProvider" </code>
after publishing the config you can see it in config/writelog.php then you can customize everything in your ways
<code class="language-php"> return [ "directory" => base_path(), // Log Store Directory path "file_name" => "debug.log" // Log file name ]; </code>
Contributions to the Writelog package are welcome. Please note the following guidelines before submitting your pull request.
- Follow PSR-4 coding standards.
Writelog is licensed under the MIT License.
Copyright 2022 Codeboxr