WP Manifestindependent plugin directory
manifest / developer / debug-bar-logger

Debug Bar Logger

Provide a common logging interface for plugins, based on the PSR-3 logging standard.

★ 6stars

Install

Download source zip No release zip yet

This is the repository archive. It installs, but the folder name will carry the branch suffix and updates will not flow.

Install straight from GitHub with WP-CLI:

wp plugin install https://github.com/rmccue/debug-bar-logger/archive/refs/heads/master.zip
No built-in updater. New versions won't appear under Dashboard → Updates. Install new releases yourself, or let Git Updater track the repository.
  1. Activate Debug Bar

  2. Activate this plugin

  3. In your plugins, use one of the following:

     # Usage 1: As a logging function
     rdbg_log( 'debug', 'This is my message', array('Data to pass as context (must be array)') );
    
     # Usage 2: As a PSR-3 compatible logger
     $logger = rdbg_logger();
     $logger->debug('This is my message', array('Data to pass as context (must be array)'));

The log level should be one of the LogLevel constants from PSR-3:

use Psr\Log\LogLevel;
// LogLevel::EMERGENCY = 'emergency';
// LogLevel::ALERT = 'alert';
// LogLevel::CRITICAL = 'critical';
// LogLevel::ERROR = 'error';
// LogLevel::WARNING = 'warning';
// LogLevel::NOTICE = 'notice';
// LogLevel::INFO = 'info';
// LogLevel::DEBUG = 'debug';