1. Go to this page and download the library: Download ahmedmerza/logscope 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/ */
ahmedmerza / logscope example snippets
$logger = new \Monolog\Logger('foo');
$logger->error('something');
use LogScope\Logging\LogScopeHandler;
$logger = new \Monolog\Logger('foo');
$logger->pushHandler(new LogScopeHandler('foo')); // 'foo' = the channel name to record
$logger->error('captured by LogScope now');
protected function setUp(): void
{
parent::setUp();
config(['logscope.write_mode' => 'batch']);
}
'json_viewer' => [
'collapse_threshold' => 5, // Auto-collapse arrays/objects larger than this
'auto_collapse_keys' => ['trace', 'stack_trace', 'stacktrace', 'backtrace'],
],
'routes' => [
'middleware' => ['web', 'auth'],
'forbidden_redirect' => '/', // Where to redirect on 403 (access denied)
'unauthenticated_redirect' => '/login', // Where to redirect on 401/419 (session expired)
],
'statuses' => [
// Disable a shortcut entirely (no triage AND no filter for this status)
'ignored' => ['shortcut' => null],
// Custom status with shortcut — works in both contexts automatically
'waiting' => ['label' => 'Waiting', 'color' => 'orange', 'shortcut' => 'w'],
],
'context' => [
'expand_objects' => true, // Set false to show [Object: ClassName]
'redact_sensitive' => true, // Set false to disable redaction (not recommended)
'sensitive_keys' => [], // Empty = use defaults, or provide your own list
'sensitive_headers' => [], // Empty = use defaults, or provide your own list
],