hexmakina/log-laddy

LogLaddy 是 PSR-3 Logger Interface 的实现,但主要针对用户界面消息

安装: 191

依赖项: 1

建议者: 0

安全: 0

星标: 0

关注者: 1

分支: 0

开放问题: 2

类型:

0.0.7 2021-09-19 13:36 UTC

This package is auto-updated.

Last update: 2024-09-15 16:51:12 UTC


README

LogLaddy 是 PSR-3 Logger Interface 的实现,但主要针对用户界面消息。它依赖于 \Psr\Log\LoggerTrait 和 \HexMakina\Debugger\Debugger

Scrutinizer Code Quality PSR-3 Compliant PSR-12 Compliant PHP 7.0 Required License Latest Stable Version

用法

要创建错误和异常之外的消息,首先初始化 LogLaddy,使用兼容的状态代理(用于存储用户消息)

$l = new LogLaddy(StateAgentInterface $agent);

然后调用其中一个消息方法

// for detailed debug information
$l->debug($message, array $context = array())

// for interesting events 
$l->info($message, array $context = array())

// for normal but significant events (and success messages)
$l->notice($message, array $context = array())

// for exceptional occurrences that are not errors
$l->warning($message, array $context = array())

// for runtime errors that do not require immediate action but should typically be logged and monitored
$l->error($message, array $context = array())

// for critical condition (Application component unavailable, unexpected exception)
$l->critical($message, array $context = array())

// when action must be taken immediately (website down, database unavailable, etc.)
$l->alert($message, array $context = array())

// when the system is unusable
$l->emergency($message, array $context = array())