PHPackages                             bvdputte/kirby-log - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Logging &amp; Monitoring](/categories/logging)
4. /
5. bvdputte/kirby-log

ActiveKirby-plugin[Logging &amp; Monitoring](/categories/logging)

bvdputte/kirby-log
==================

Logging utility for Kirby 3 - based on katzgrau/KLogger

2.2.1(3y ago)2110.7k↓57.3%1MITPHP

Since Feb 7Pushed 1mo ago1 watchersCompare

[ Source](https://github.com/bvdputte/kirby-log)[ Packagist](https://packagist.org/packages/bvdputte/kirby-log)[ RSS](/packages/bvdputte-kirby-log/feed)WikiDiscussions master Synced 2d ago

READMEChangelog (5)Dependencies (3)Versions (7)Used By (0)

Kirby log plugin
================

[](#kirby-log-plugin)

A little log utility you can use with Kirby CMS. It's a wrapper around [KLogger](https://github.com/katzgrau/KLogger).

Installation
------------

[](#installation)

- unzip [master.zip](https://github.com/bvdputte/kirby-log/archive/master.zip) as folder `site/plugins/kirby-log` or
- `git submodule add https://github.com/bvdputte/kirby-log.git site/plugins/kirby-log` or
- `composer require bvdputte/kirby-log`

Usage
-----

[](#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:
------------

[](#logging-api)

```
$site->log("message", "level" /* optional */, "appendcontext" /* optional */);
```

### Default usage

[](#default-usage)

```
$site->log("This text will be added to the default log");
```

- 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

[](#define-the-loglevel)

As defined by [PSR-3](https://www.php-fig.org/psr/psr-3/#5-psrlogloglevel), you can pass the wanted loglevel as the second argument in the `->log()` method:

```
$site->log("My message", "error");
```

- 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](#kirby-configurable-options).

### Log variables to log

[](#log-variables-to-log)

AppendContext can be interesting to include variables to your log.

```
$arr = ["foo", "bar", "baz"];
$site->log("My message", "debug", $arr);
```

- Output:

```
[2018-08-06 17:26:50.373625] [debug] My message
    0: 'foo'
    1: 'bar'
    2: 'baz'

```

- Logfile: `/site/logs/kirbylog.log`

Customize the logger
--------------------

[](#customize-the-logger)

API:

```
$site->logger("logname", "options" /* optional */, "defaultlevel" /* optional */)->log("message", "level" /* optional */, "appendcontext" /* optional */);
```

### 1. Custom log name

[](#1-custom-log-name)

```
$site->logger("my-own-logfile.log")->log("This event will be added to my custom named logfile");
```

- 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

[](#2-extended-options-for-the-logger)

Several extended options are available:

- dateFormat: [use PHP syntax](http://php.net/manual/en/function.date.php)
- logFormat: [formatting options](https://github.com/katzgrau/KLogger#log-formatting)
- [appendContext](#3-appendcontext): Enable/Disable

Pass them as follows to the logger using an associative array:

```
$options = [
    'dateFormat'     => 'Y-m-d G:i:s.u',
    'logFormat'      => false,
    'appendContext'  => true,
];
$site->logger("infolog.log", $options)->log("Info about something", "info");
```

More info on [KLogger docs](https://github.com/katzgrau/KLogger#additional-options).

Kirby configurable options
--------------------------

[](#kirby-configurable-options)

1. 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](https://getkirby.com/docs/guide/configuration#custom-folder-setup) and then change the [logs root](https://getkirby.com/docs/reference/system/roots/logs).
2. The default logname is `kirbylog.log`. Change it in `config.php` via `'bvdputte.kirbylog.logname' => 'custom-logname.log'`.
3. The default loglevel is `info`. Change it in `config.php` via `'bvdputte.kirbylog.defaultloglevel' => 'debug'`. Be sure to [use a valid PSR-3 loglevel](#loglevel).
4. `'bvdputte.kirbylog.rotateLogs' => true`: log rotation is on by default when logs get bigger then 10MB. Set to false to disable logrotation
5. `'bvdputte.kirbylog.rotateLogSizeThreshold' => '10MB' // can be in 'B', 'KB', 'MB' or 'GB'`: the size-based threshold for logrotation. Defaults to 10MB

Disclaimer
----------

[](#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](https://github.com/bvdputte/kirby-log/issues/new).

License
-------

[](#license)

[MIT](https://opensource.org/licenses/MIT)

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.

###  Health Score

46

—

FairBetter than 92% of packages

Maintenance60

Regular maintenance activity

Popularity32

Limited adoption so far

Community10

Small or concentrated contributor base

Maturity65

Established project with proven stability

 Bus Factor1

Top contributor holds 78.6% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~279 days

Recently: every ~141 days

Total

6

Last Release

1307d ago

Major Versions

1.0.0 → v2.0.02021-05-18

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/490505?v=4)[Bart Vandeputte](/maintainers/bvdputte)[@bvdputte](https://github.com/bvdputte)

---

Top Contributors

[![bvdputte](https://avatars.githubusercontent.com/u/490505?v=4)](https://github.com/bvdputte "bvdputte (11 commits)")[![bnomei](https://avatars.githubusercontent.com/u/3265642?v=4)](https://github.com/bnomei "bnomei (3 commits)")

### Embed Badge

![Health badge](/badges/bvdputte-kirby-log/health.svg)

```
[![Health](https://phpackages.com/badges/bvdputte-kirby-log/health.svg)](https://phpackages.com/packages/bvdputte-kirby-log)
```

###  Alternatives

[getkirby/cms

The Kirby core

1.5k584.8k474](/packages/getkirby-cms)[medienbaecker/kirby-modules

Easily add modules to your pages

895.5k1](/packages/medienbaecker-kirby-modules)[brianhenryie/bh-wp-logger

A PSR logger for WordPress plugins, with a nice WP\_List\_Table UI.

1921.2k](/packages/brianhenryie-bh-wp-logger)[thathoff/kirby-sentry

Sentry integration for Kirby

1920.0k](/packages/thathoff-kirby-sentry)[johannschopplich/kirby-content-translator

DeepL &amp; AI-powered content translation for Kirby CMS

2010.8k](/packages/johannschopplich-kirby-content-translator)[johannschopplich/kirbylog

Zero-dependency global `kirbylog()` helper for any content

284.3k2](/packages/johannschopplich-kirbylog)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
