Linux 软件免费装

Debug Logger

开发者 awoods
更新时间 2021年5月4日 04:02
PHP版本: 7.4 及以上
WordPress版本: 5.7
版权: GPLv2 or later
版权网址: 版权信息

标签

debug development logging logs dev psr-3 monolog

下载

0.2.0 0.3.0

详情介绍:

As PHP moves forward, so must WordPress. This plugin helps WordPress use the tools of modern PHP. Monolog — PHP's most popular logging package — is a composer package. Since WordPress doesn't currently have a universal way to support composer, this WordPress plugin is meant to start bridging the gap. This logger is PSR-3 compliant, a PHP standard which Monolog also uses.

安装:

This section describes how to install the plugin and get it working.
  1. Upload the wp-debug-logger folder to the /wp-content/plugins/ directory
  2. Activate the plugin through the 'Plugins' menu in WordPress
  3. Enable debugging in your wp-config.php
` // in your wp-config.php define( 'WP_DEBUG', true ); define( 'WP_DEBUG_DISPLAY', false ); define( 'WP_DEBUG_LOG', true ); define( 'WP_DEBUG_MINIMUM_LEVEL', 'debug' ); // For good measure, this will hide errors from being displayed on-screen @ini_set('display_errors', 0); `
  1. As you write your code, sprinkle in these Log methods.
Minimum Level WP_DEBUG_MINIMUM_LEVEL is a new constant that determines the minimum severity level you wish to write to your wp-content/debug.log file. In your development environment, I recommend using debug so you can see all the errors being written. For your production environment, I'd recommend the error level, so you can capture all the significant problems. Here are the values to use: emergency, alert, critical, error, warning, notice, info, debug. Note: they're all lowercase, as the value is case-sensitive. Displaying Errors In your development environment, you may choose to set WP_DEBUG_DISPLAY to true, so the error messages show in your browser. However, I strongly recommend that you do not change it, for your production environment. These settings can be placed anywhere above the line. /* That’s all, stop editing! Happy blogging. */

升级注意事项:

0.3.0 Gain the ability to log WP_Error objects

常见问题:

Why not just use the error_log function?

You still can. However, the plugin will add value to your logging efforts. Using this logger will add structure io the debug.log file, and give you a modern PHP interface to control the amount of logging in your website. The logging methods in this plugin also provide information about the severity of the error.

Where can I find more documentation?

This project is developed on Github. There is a more complete readme there, with links to supplemental information.

Why use PSR-3?

A PSR is a PHP Standard Recommendation. PSRs are use to create and maintain interoperability between PHP-based frameworks and content management systems.

更新日志:

0.3.0 0.2.0 0.1.0