PHP code example of tixelrocks / laravel-safe-logger
1. Go to this page and download the library: Download tixelrocks/laravel-safe-logger library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
tixelrocks / laravel-safe-logger example snippets
Log::emergency('Something bad happened!', false);
Illuminate\Log\LogManager::emergency(): Argument #2 ($context) must be of type array, bool given, called in vendor/laravel/framework/src/Illuminate/Support/Facades/Facade.php on line 338 in vendor/psy/psysh/src/Exception/TypeErrorException.php on line 53.
try {
$details = $api->request(); // $api is some kind of a third-party SDK
} catch (ClientException $e) {
// $e->getResponse() might have a nice JSON error message but might have a CDN's HTML error or something else
Log::emergency("Oh no, we got a failed API request!", json_decode($e->getResponse()->getContent()));
}