A Monolog-based logging tool for WordPress. Supports storing log message in a custom post type or in individual posts and terms.
This package is auto-updated.
Last update: 2023-11-30 02:26:42 UTC
Providing a WordPress integration with Monolog, allowing site-wide and post and term specific logging.
See the wiki for complete information and more examples.
Logger requires PHP 8.0 and Composer to run properly.
composer require alleyinteractive/logger
You can also install the plugin as a submodule by using the
*-built tag of a
AI Logger is a complete interface to Monolog with some nice WordPress handlers built in.
// Log site-wide to the ai_log post type. ai_logger()->info( 'Log message...' ); \AI_Logger\AI_Logger::info( 'Another format for logging.' );
Logs will be appended to a post's meta for review.
ai_logger_to_post( $post_id, 'meta-key' )->info( 'This will log to the <meta-key> for a specific post.' );
Logs will be appended to a term's meta for review.
ai_logger_to_term( $term_id, 'meta-key' )->info( 'This will log to the <meta-key> for a specific term.' );
ai_logger_to_qm()->info( 'This will show up in Query Monitor!' );
ai_logger()->with_context( 'example-context' )->info( 'This will log to the example-context.' );
Also supports an array of default log context:
ai_logger()->with_context( [ 'context' => 'example-context', 'key' => 'value', ] )->info( 'This will log to the example-context with key=>value.' );
You can also pass the context to
ai_logger( 'example-context' )->info( 'This will log to the example-context.' );
Please see CHANGELOG for more information on what has changed recently.
This software is released under the terms of the GNU General Public License version 2 or any later version.