Download the PHP package bvdputte/kirby-log without Composer
On this page you can find all versions of the php package bvdputte/kirby-log. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download bvdputte/kirby-log
More information about bvdputte/kirby-log
Files in bvdputte/kirby-log
Package kirby-log
Short Description Logging utility for Kirby 3 - based on katzgrau/KLogger
License MIT
Informations about the package kirby-log
Kirby log plugin
A little log utility you can use with Kirby CMS. It's a wrapper around KLogger.
Installation
- unzip master.zip as folder
site/plugins/kirby-log
or git submodule add https://github.com/bvdputte/kirby-log.git site/plugins/kirby-log
orcomposer require bvdputte/kirby-log
Usage
By default, all kirby system exceptions are logged to site/logs/kirbylog.log
.
(Can be disabled via 'bvdputte.kirbylog.exceptionlog' => false
in config.php.
Logging API:
Default usage
- Output:
[2018-08-06 17:26:50.376956] [info] This text will be added to the default log
. - Logfile:
/site/logs/kirbylog.log
💡 The logfile will be created automatically when not existant.
Define the loglevel
As defined by PSR-3, you can pass the wanted loglevel as the second argument in the ->log()
method:
- Output:
[2018-08-06 17:26:50.372955] [error] My message
- Logfile:
/site/logs/kirbylog.log
💡 By default the loglevel is info
. This can be set in the options.
Log variables to log
AppendContext can be interesting to include variables to your log.
-
Output:
- Logfile:
/site/logs/kirbylog.log
Customize the logger
API:
1. Custom log name
- Output:
[2018-08-06 17:26:50.376956] [info] This event will be added to my custom named logfile
. - Logfile:
/site/logs/my-own-logfile.log
2. Extended options for the logger
Several extended options are available:
- dateFormat: use PHP syntax
- logFormat: formatting options
- appendContext: Enable/Disable
Pass them as follows to the logger using an associative array:
More info on KLogger docs.
Kirby configurable options
- The default location where logfiles will be saved is the Kirby default logs location:
/site/logs/
. You can change this locaction via the custom folder setup and then change the logs root. - The default logname is
kirbylog.log
. Change it inconfig.php
via'bvdputte.kirbylog.logname' => 'custom-logname.log'
. - The default loglevel is
info
. Change it inconfig.php
via'bvdputte.kirbylog.defaultloglevel' => 'debug'
. Be sure to use a valid PSR-3 loglevel. 'bvdputte.kirbylog.rotateLogs' => true
: log rotation is on by default when logs get bigger then 10MB. Set to false to disable logrotation'bvdputte.kirbylog.rotateLogSizeThreshold' => '10MB' // can be in 'B', 'KB', 'MB' or 'GB'
: the size-based threshold for logrotation. Defaults to 10MB
Disclaimer
This plugin is provided "as is" with no guarantee. Use it at your own risk and always test it yourself before using it in a production environment. If you find any issues, please create a new issue.
License
It is discouraged to use this plugin in any project that promotes racism, sexism, homophobia, animal abuse, violence or any other form of hate speech.
All versions of kirby-log with dependencies
katzgrau/klogger Version ^1.2.2
studio24/rotate Version ^1.0