alleyinteractive / logger
A Monolog-based logging tool for WordPress. Supports storing log message in a custom post type or in individual posts and terms.
Installs: 33 184
Dependents: 0
Suggesters: 1
Security: 0
Stars: 27
Watchers: 50
Forks: 4
Open Issues: 6
Type:wordpress-plugin
Requires
- php: ^8.1
- alleyinteractive/composer-wordpress-autoloader: ^1.0
- mantle-framework/support: ^1.0
- monolog/monolog: ^2.8
- psr/log: ^1.0|^2.0|^3.0
- spatie/backtrace: ^1.6
Requires (Dev)
- dev-develop
- v2.5.1
- v2.5.0
- v2.4.4
- v2.4.3
- v2.4.2
- v2.4.1
- v2.4.0
- v2.3.3
- v2.3.2
- v2.3.1
- v2.3.0
- v2.2.0
- v2.1.6
- v2.1.5
- v2.1.4
- v2.1.3
- v2.1.2
- v2.1.1
- v2.1.0
- v2.1-beta2
- v2.1-beta1
- v2.0
- dev-develop-built
- dev-feature/condense-trace-do-action
- dev-hotfix/shutdown-wp-themes
- dev-feature/scope-composer
- dev-release/2.3
- dev-main-built
- dev-release/2.1
This package is auto-updated.
Last update: 2024-12-20 16:53:26 UTC
README
Providing a WordPress integration with Monolog, allowing site-wide and post and term specific logging.
Documentation
See the wiki for complete information and more examples.
Installation
Logger requires PHP 8.1 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
release.
Usage
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.' );
Logging to a Specific Post
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.' );
Logging to a Specific Term
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.' );
Logging to Query Monitor
ai_logger_to_qm()->info( 'This will show up in Query Monitor!' );
Logging with Default Context
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()
directly:
ai_logger( 'example-context' )->info( 'This will log to the example-context.' );
Changelog
Please see CHANGELOG for more information on what has changed recently.
Maintainers
This project is actively maintained by Alley Interactive. Like what you see? Come work with us.
License
This software is released under the terms of the GNU General Public License version 2 or any later version.