Stars: 167
Forks: 16
Pull Requests: 20
Issues: 52
Watchers: 17
Last Updated: 2023-03-01 13:57:35
Monolog-based logging package for WordPress.
License: MIT License
Languages: PHP
Monolog-based logging package for WordPress.
Wonolog is a Composer package (not a plugin) that allows to log anything that happens in a WordPress site.
It is based on Monolog, which, with its over 38 millions of downloads and thousands of dependent packages, is the most popular logging library for PHP, compatible with the PSR-3 standard.
Wonolog requires:
Via Composer, Wonolog requires monolog/monolog
(MIT).
When installed for development, via Composer, Wonolog also requires:
phpunit/phpunit
(BSD-3-Clause)brain/monkey
(MIT)mikey179/vfsStream
(BSD-3-Clause)Wonolog should be installed via Composer.
Its package name is inpsyde/wonolog
.
The suggested way to use Wonolog is at website level.
If you don't use Composer to manage your whole website then Wonolog is probably not for you. You might be able to use it anyway, but support is not guaranteed.
It's easily possible to develop plugins and themes compatible with Wonolog logging even without explicitly declaring it as a dependency.
A couple of noteworthy things:
On the bright side, Wonolog comes with a super easy bootstrap routine and some out-of-the-box configurations that make it possible to have a working and effective logging system with zero effort.
To get started with defaults settings, this is required:
wp-config.php
or anytime before the 'muplugins_loaded'
action is fired;<?php
Inpsyde\Wonolog\bootstrap();
The three steps described above are all that is necessary to have a working logging system that uses Monolog to write logs in a file. The path of that file changes based on current date, using the following format:
{WP_CONTENT_DIR}/wonolog/{Y/m/d}.log
,with {Y/m/d}
being replaced by date( 'Y/m/d' )
.
For example, a target file could be /wp-content/2017/02/27.log
.
What is actually logged depends on the value of WP_DEBUG_LOG
constant.
When WP_DEBUG_LOG
is set to true
, Wonolog will log everything.
When WP_DEBUG_LOG
is set to false
, Wonolog will only log events with a log level higher or equal to ERROR
, according to PSR-3 log levels.
"Automatically" logged events include:
wp_mail()
errors, and 404 errors).This is just the default behavior.
The bootstrap()
function provides entry points for many configurations and customizations.
Moreover, the package provides both action and filter hooks, and can be configured via environment variables, which makes Wonolog very flexible, and exposes all the power that Monolog provides.
Documentation of Wonolog features, defaults, configuration and ways to extends it can be found in separate files:
Copyright (c) 2017 Inpsyde GmbH.
Wonolog code is licensed under MIT license.
The team at Inpsyde is engineering the Web since 2006.