PHP code example of decahedron / monolog-sticky-context
1. Go to this page and download the library: Download decahedron/monolog-sticky-context 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/ */
decahedron / monolog-sticky-context example snippets
StickyContext::add('user', 1);
$logger->info('Something happened'); // This will ext is now empty and not
StickyContext::add('user', function () {
return user()->id;
});
// Somewhere in the package
StickyContext::stack('my_package')->add('request_id', Uuid::uuid4()->toString());
// In the application
StickyContext::add('user', user()->id);