方法
__construct()
构造函数
public function __construct (
array $config = []
)
__destruct()
析构函数
public function __destruct ()
log()
可任意级别记录日志
public function log (
string $level,
string $message,
array $context = []
)
| 参数: |
| 名称 |
说明 |
| level |
日志级别 |
| message |
日志内容 |
| context |
占位符内容 |
|
emergency()
System is unusable.
public function emergency (
string $message,
array $context = []
) : void
alert()
Action must be taken immediately.
public function alert (
string $message,
array $context = []
) : void
Example: Entire website down, database unavailable, etc. This should
trigger the SMS alerts and wake you up.
critical()
Critical conditions.
public function critical (
string $message,
array $context = []
) : void
Example: Application component unavailable, unexpected exception.
error()
Runtime errors that do not require immediate action but should typically
be logged and monitored.
public function error (
string $message,
array $context = []
) : void
warning()
Exceptional occurrences that are not errors.
public function warning (
string $message,
array $context = []
) : void
Example: Use of deprecated APIs, poor use of an API, undesirable things
that are not necessarily wrong.
notice()
Normal but significant events.
public function notice (
string $message,
array $context = []
) : void
info()
Interesting events.
public function info (
string $message,
array $context = []
) : void
Example: User logs in, SQL logs.
debug()
Detailed debug information.
public function debug (
string $message,
array $context = []
) : void