alleyinteractive / logger
基于Monolog的WordPress日志工具。支持将日志消息存储在自定义帖子类型或单个帖子中。
v2.5.0
2024-09-04 01:27 UTC
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.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-performance/schedule
- 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-09-04 01:28:08 UTC
README
提供Monolog与WordPress的集成,允许全局以及针对帖子或术语的特定日志记录。
文档
查看wiki获取完整信息和更多示例。
安装
Logger需要PHP 8.1和Composer才能正常运行。
composer require alleyinteractive/logger
您也可以通过使用发布版的*-built
标签将插件作为子模块安装。
使用
AI Logger是Monolog的完整接口,内置了一些优秀的WordPress处理器。
// Log site-wide to the ai_log post type. ai_logger()->info( 'Log message...' ); \AI_Logger\AI_Logger::info( 'Another format for logging.' );
针对特定帖子的日志记录
日志将附加到帖子的元数据以供审查。
ai_logger_to_post( $post_id, 'meta-key' )->info( 'This will log to the <meta-key> for a specific post.' );
针对特定术语的日志记录
日志将附加到术语的元数据以供审查。
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.' );
还支持默认日志上下文的数组
ai_logger()->with_context( [ 'context' => 'example-context', 'key' => 'value', ] )->info( 'This will log to the example-context with key=>value.' );
您也可以直接将上下文传递给ai_logger()
ai_logger( 'example-context' )->info( 'This will log to the example-context.' );
变更日志
请参阅CHANGELOG了解最近更改的更多信息。
维护者
该项目由Alley Interactive积极维护。喜欢你所看到的?加入我们。
许可
本软件根据GNU通用公共许可证第2版或任何后续版本发布。