基于Monolog的WordPress日志工具。支持将日志消息存储在自定义帖子类型或单个帖子中。

安装数: 12,983

依赖: 0

建议: 1

安全: 0

星星: 27

关注者: 50

分支: 4

开放问题: 6

类型:wordpress-plugin

v2.5.0 2024-09-04 01:27 UTC

README

Testing Suite Coding Standards

提供Monolog与WordPress的集成,允许全局以及针对帖子或术语的特定日志记录。

Screenshot of Example Log

文档

查看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积极维护。喜欢你所看到的?加入我们

Alley logo

许可

本软件根据GNU通用公共许可证第2版或任何后续版本发布。