{"id":140360,"date":"2021-04-30T03:28:03","date_gmt":"2021-04-30T03:28:03","guid":{"rendered":"https:\/\/wordpress.org\/plugins\/debug-logger\/"},"modified":"2021-05-03T20:02:25","modified_gmt":"2021-05-03T20:02:25","slug":"debug-logger","status":"publish","type":"plugin","link":"https:\/\/sw.wordpress.org\/plugins\/debug-logger\/","author":10092888,"comment_status":"closed","ping_status":"closed","template":"","meta":{"_crdt_document":"","version":"0.3.0","stable_tag":"0.3.0","tested":"5.7.15","requires":"5.7","requires_php":"7.4","requires_plugins":"","header_name":"Debug Logger","header_author":"awoods","header_description":"Provide a PSR-3 compatible logger for WordPress","assets_banners_color":"","last_updated":"2021-05-03 20:02:25","external_support_url":"","external_repository_url":"","donate_link":"","header_plugin_uri":"https:\/\/github.com\/andrewwoods\/wp-debug-logger","header_author_uri":"https:\/\/andrewwoods.net","rating":0,"author_block_rating":0,"active_installs":0,"downloads":1012,"num_ratings":0,"support_threads":0,"support_threads_resolved":0,"author_block_count":0,"sections":["description","installation","faq","changelog"],"tags":{"0.2.0":{"tag":"0.2.0","author":"awoods","date":"2021-04-30 03:40:42"},"0.3.0":{"tag":"0.3.0","author":"awoods","date":"2021-05-03 20:02:25"}},"upgrade_notice":{"0.3.0":"<p>Gain the ability to log WP_Error objects<\/p>"},"ratings":[],"assets_icons":[],"assets_banners":[],"assets_blueprints":{},"all_blocks":[],"tagged_versions":["0.2.0","0.3.0"],"block_files":[],"assets_screenshots":[],"screenshots":[],"jetpack_post_was_ever_published":false},"plugin_section":[],"plugin_tags":[94,1522,1955,199002,199001],"plugin_category":[59],"plugin_contributors":[97739],"plugin_business_model":[],"class_list":["post-140360","plugin","type-plugin","status-publish","hentry","plugin_tags-debug","plugin_tags-logging","plugin_tags-logs","plugin_tags-monolog","plugin_tags-psr-3","plugin_category-utilities-and-tools","plugin_contributors-awoods","plugin_committers-awoods"],"banners":[],"icons":{"svg":false,"icon":"https:\/\/s.w.org\/plugins\/geopattern-icon\/debug-logger.svg","icon_2x":false,"generated":true},"screenshots":[],"raw_content":"<!--section=description-->\n<p>As PHP moves forward, so must WordPress. This plugin helps WordPress use the tools of modern PHP. Monolog \u2014 PHP's most popular logging package \u2014 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 <a href=\"https:\/\/github.com\/php-fig\/fig-standards\/blob\/master\/accepted\/PSR-3-logger-interface.md\">PSR-3<\/a> compliant, a PHP standard which Monolog also uses.<\/p>\n\n<h3>Logging Levels<\/h3>\n\n<p>There are 8 logging levels available, <a href=\"https:\/\/tools.ietf.org\/html\/rfc5424\">defined by RFC 5424<\/a>. The levels specified in\norder from the most severe to the least severe:<\/p>\n\n<ul>\n<li><strong>Emergency<\/strong>: system is unusable<\/li>\n<li><strong>Alert<\/strong>: action must be taken immediately<\/li>\n<li><strong>Critical<\/strong>: critical conditions<\/li>\n<li><strong>Error<\/strong>: error conditions<\/li>\n<li><strong>Warning<\/strong>: warning conditions<\/li>\n<li><strong>Notice<\/strong>: normal but significant condition<\/li>\n<li><strong>Info<\/strong>: informational messages<\/li>\n<li><strong>Debug<\/strong>: debug-level messages<\/li>\n<\/ul>\n\n<!--section=installation-->\n<p>This section describes how to install the plugin and get it working.<\/p>\n\n<ol>\n<li>Upload the <code>wp-debug-logger<\/code> folder to the <code>\/wp-content\/plugins\/<\/code> directory<\/li>\n<li>Activate the plugin through the 'Plugins' menu in WordPress<\/li>\n<li><p>Enable debugging in your <code>wp-config.php<\/code><\/p>\n\n<p>\/\/ in your wp-config.php\ndefine( 'WP_DEBUG', true );\ndefine( 'WP_DEBUG_DISPLAY', false );\ndefine( 'WP_DEBUG_LOG', true );\ndefine( 'WP_DEBUG_MINIMUM_LEVEL', 'debug' );<\/p>\n\n<p>\/\/ For good measure, this will hide errors from being displayed on-screen\n@ini_set('display_errors', 0);<\/p><\/li>\n<li><p>As you write your code, sprinkle in these Log methods.<\/p><\/li>\n<\/ol>\n\n<h4>Minimum Level<\/h4>\n\n<p>WP_DEBUG_MINIMUM_LEVEL is a new constant that determines the minimum severity level you wish to write to your <em>wp-content\/debug.log<\/em> file. In your <em>development<\/em> environment, I recommend using <code>debug<\/code> so you can see all the errors being written. For your <em>production<\/em> environment, I'd recommend the <code>error<\/code> level, so you can capture all the significant problems. Here are the values to use: <strong>emergency, alert, critical, error, warning, notice, info, debug<\/strong>. Note: they're all lowercase, as the value is case-sensitive.<\/p>\n\n<h4>Displaying Errors<\/h4>\n\n<p>In your <strong>development<\/strong> environment, you may choose to set <code>WP_DEBUG_DISPLAY<\/code> to <code>true<\/code>, so the error messages show in your browser. However, I <strong>strongly recommend<\/strong> that you do not change it, for your <em>production<\/em> environment. These settings can be placed anywhere above the line.<\/p>\n\n<pre><code>\/* That\u2019s all, stop editing! Happy blogging. *\/\n<\/code><\/pre>\n\n<!--section=faq-->\n<dl>\n<dt id='why%20not%20just%20use%20the%20error_log%20function%3F'><h3>Why not just use the error_log function?<\/h3><\/dt>\n<dd><p>You still can. However, the plugin will add value to your logging efforts. Using this logger will add structure io the debug.log file, <em>and<\/em> 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.<\/p><\/dd>\n<dt id='where%20can%20i%20find%20more%20documentation%3F'><h3>Where can I find more documentation?<\/h3><\/dt>\n<dd><p>This project is <a href=\"https:\/\/github.com\/andrewwoods\/wp-debug-logger\">developed on Github<\/a>. There is a more complete readme there, with links to supplemental information.<\/p><\/dd>\n<dt id='why%20use%20psr-3%3F'><h3>Why use PSR-3?<\/h3><\/dt>\n<dd><p>A PSR is a PHP Standard Recommendation. PSRs are use to create and maintain interoperability between PHP-based frameworks and content management systems.<\/p><\/dd>\n\n<\/dl>\n\n<!--section=changelog-->\n<h4>0.3.0<\/h4>\n\n<ul>\n<li>Add the ability to log WP_Error objects\n\n<ul>\n<li>Add <code>Log::wp_error()<\/code> and its corresponding <code>Logger-&gt;log_wp_error<\/code> method<\/li>\n<li>Add method Logger-&gt;has_level() to ensure a level exists<\/li>\n<\/ul><\/li>\n<\/ul>\n\n<h4>0.2.0<\/h4>\n\n<ul>\n<li>Add <code>Log::print()<\/code> and <code>Log::dump()<\/code> methods<\/li>\n<li>Improve documentation<\/li>\n<\/ul>\n\n<h4>0.1.0<\/h4>\n\n<ul>\n<li>Import PSR-3 from PHP FIG into <code>lib<\/code> directory<\/li>\n<li>Create Logger class to write log<\/li>\n<li>Create Log class to statically interact with Logger class<\/li>\n<li>Add usage instructions and logging levels<\/li>\n<\/ul>","raw_excerpt":"Provide a PSR-3 compatible logger for WordPress core that writes to the debug.log","jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/sw.wordpress.org\/plugins\/wp-json\/wp\/v2\/plugin\/140360","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/sw.wordpress.org\/plugins\/wp-json\/wp\/v2\/plugin"}],"about":[{"href":"https:\/\/sw.wordpress.org\/plugins\/wp-json\/wp\/v2\/types\/plugin"}],"replies":[{"embeddable":true,"href":"https:\/\/sw.wordpress.org\/plugins\/wp-json\/wp\/v2\/comments?post=140360"}],"author":[{"embeddable":true,"href":"https:\/\/sw.wordpress.org\/plugins\/wp-json\/wporg\/v1\/users\/awoods"}],"wp:attachment":[{"href":"https:\/\/sw.wordpress.org\/plugins\/wp-json\/wp\/v2\/media?parent=140360"}],"wp:term":[{"taxonomy":"plugin_section","embeddable":true,"href":"https:\/\/sw.wordpress.org\/plugins\/wp-json\/wp\/v2\/plugin_section?post=140360"},{"taxonomy":"plugin_tags","embeddable":true,"href":"https:\/\/sw.wordpress.org\/plugins\/wp-json\/wp\/v2\/plugin_tags?post=140360"},{"taxonomy":"plugin_category","embeddable":true,"href":"https:\/\/sw.wordpress.org\/plugins\/wp-json\/wp\/v2\/plugin_category?post=140360"},{"taxonomy":"plugin_contributors","embeddable":true,"href":"https:\/\/sw.wordpress.org\/plugins\/wp-json\/wp\/v2\/plugin_contributors?post=140360"},{"taxonomy":"plugin_business_model","embeddable":true,"href":"https:\/\/sw.wordpress.org\/plugins\/wp-json\/wp\/v2\/plugin_business_model?post=140360"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}