presprog/kirby-monolog
最新稳定版本:0.1.1
Composer 安装命令:
composer require presprog/kirby-monolog
包简介
Use the Monolog logger library with Kirby CMS
README 文档
README
This plugin adds the Monolog logging library to Kirby.
⚡ Ready for Kirby 4!
🤟Usage
Use the monolog() helper function:
// Write to the default log file monolog()->log('something happend 😱'); // Log to another channel (only changes the filename for now) // Will log to "your-log-dir/other-channel-$date.log" monolog('other-channel')->log('something happend 😱'); // Change the log level (any of \Psr\Log\LogLevel) monolog()->log('something CRITICAL happend 😱', 'critical'); // …
If you throw and handle exceptions in your own code, you may log them with site()->logException():
try { // .. } catch(\Exception $exception) { site()->logException($exception) }
This will log the exception message with critical level alongside the stack trace.
The plugin also automatically listens to Kirby system.exception hook and logs the exception message as well as the stacktrace to the default log file.
💻 How to install
via Composer (recommended)
$ composer require presprog/kirby-monolog:^0.1
via ZIP archive
Download the ZIP archive, extract it into your plugins folder (defaults to site/plugins) and rename the subfolder to monolog.
✅ To do
- Define more channels via the config file
- …
Alternatives
There are plenty of alternatives:
- bnomei/monolog by Bruno Meilick (This one also integrates Monolog)
- johannschopplich/kirbylog by Johann Schopplich (This one is dependency-free!)
- michnhokn/logger by Michael Scheurich
- bvdputte/log by Bert Vandeputte
Made with ♥️ and ☕ by Present Progressive
统计信息
- 总下载量: 500
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 1
- 点击次数: 0
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2024-02-09