1. Go to this page and download the library: Download michnhokn/kirby3-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/ */
michnhokn / kirby3-logger example snippets
// site/config/config.php
return [
'michnhokn.logger' => [
// optional - add your custom channels for better filtering in the panel
'channels' => ['custom', 'my-plugin-a'],
// optional - add specific hooks to an ignore list to prevent spamming in the panel
'ignoreHooks' => [
'page.render:after',
'kirbytags:after'
]
]
];
// Write a custom log entry
\Michnhokn\Logger::write(
message: 'Whoops! Something bad happened.',
level: Logger::LEVEL_ERROR,
context: ['userId' => App::instance()->user()?->id()]
);
// you can also use all available levels as a method name
\Michnhokn\Logger::info('A user logged in.',context: ['userId' => App::instance()->user()?->id()]);
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.