GithubHelp home page GithubHelp logo

jenkoian / wonolog Goto Github PK

View Code? Open in Web Editor NEW

This project forked from inpsyde/wonolog

0.0 2.0 0.0 822 KB

Monolog-based logging package for WordPress.

Home Page: https://inpsyde.github.io/Wonolog/

License: MIT License

PHP 100.00%

wonolog's Introduction

Wonolog

Version Status Build Downloads License

Wonolog

Monolog-based logging package for WordPress.


Table of Contents


Introduction

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.

Minimum Requirements and Dependencies

Wonolog requires:

  • PHP 5.6+
  • WordPress 4.6+

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)

Getting Started

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:

  • all Wonolog configurations have to be done in a MU plugin;
  • in a WordPress multisite installation, all Wonolog configurations are naturally site-wide.

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:

  1. install Wonolog via Composer;
  2. ensure Composer autoload is loaded in wp-config.php or anytime before the 'muplugins_loaded' action is fired;
  3. create a MU plugin that, at least, contains this code:
<?php
Inpsyde\Wonolog\bootstrap();

Wonolog Defaults

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:

  • PHP core notices, warnings and (fatal) errors;
  • uncaught exceptions;
  • WordPress errors and events (e.g., DB errors, HTTP API errors, 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.

Learn More

Documentation of Wonolog features, defaults, configuration and ways to extends it can be found in separate files:

License and Copyright

Copyright (c) 2017 Inpsyde GmbH.

Wonolog code is licensed under MIT license.

The team at Inpsyde is engineering the Web since 2006.

wonolog's People

Contributors

gmazzap avatar tfrommen avatar dnaber-de avatar websupporter avatar alexwoollam avatar noplanman avatar widoz avatar nielsdeblaauw avatar redelschaap avatar chesio avatar

Watchers

James Cloos avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.