\think\logChannel

Summary

Methods
Properties
Constants
__construct()
close()
clear()
record()
write()
getLog()
save()
emergency()
alert()
critical()
error()
warning()
notice()
info()
debug()
log()
__call()
No public properties found
No constants found
No protected methods found
$name
$logger
$event
$lazy
$log
$close
$allow
N/A
No private methods found
No private properties found
N/A

Properties

$name

$name

$logger

$logger

$event

$event

$lazy

$lazy

$log

$log : array

日志信息

Type

array

$close

$close : array

关闭日志

Type

array

$allow

$allow : array

允许写入类型

Type

array

Methods

__construct()

__construct(string  $name, \think\contract\LogHandlerInterface  $logger, array  $allow, bool  $lazy = true, \think\Event  $event = null) : mixed

Parameters

string $name
\think\contract\LogHandlerInterface $logger
array $allow
bool $lazy
\think\Event $event

Returns

mixed —

close()

close() : mixed

关闭通道

Returns

mixed —

clear()

clear() : mixed

清空日志

Returns

mixed —

record()

record(mixed  $msg, string  $type = 'info', array  $context = [], bool  $lazy = true) : $this

记录日志信息

Parameters

mixed $msg

日志信息

string $type

日志级别

array $context

替换内容

bool $lazy

Returns

$this —

write()

write(mixed  $msg, string  $type = 'info', array  $context = []) : $this

实时写入日志信息

Parameters

mixed $msg

调试信息

string $type

日志级别

array $context

替换内容

Returns

$this —

getLog()

getLog() : array

获取日志信息

Returns

array —

save()

save() : bool

保存日志

Returns

bool —

emergency()

emergency(string  $message, array  $context = []) : void

System is unusable.

Parameters

string $message
array $context

alert()

alert(string  $message, array  $context = []) : void

Action must be taken immediately.

Example: Entire website down, database unavailable, etc. This should trigger the SMS alerts and wake you up.

Parameters

string $message
array $context

critical()

critical(string  $message, array  $context = []) : void

Critical conditions.

Example: Application component unavailable, unexpected exception.

Parameters

string $message
array $context

error()

error(string  $message, array  $context = []) : void

Runtime errors that do not require immediate action but should typically be logged and monitored.

Parameters

string $message
array $context

warning()

warning(string  $message, array  $context = []) : void

Exceptional occurrences that are not errors.

Example: Use of deprecated APIs, poor use of an API, undesirable things that are not necessarily wrong.

Parameters

string $message
array $context

notice()

notice(string  $message, array  $context = []) : void

Normal but significant events.

Parameters

string $message
array $context

info()

info(string  $message, array  $context = []) : void

Interesting events.

Example: User logs in, SQL logs.

Parameters

string $message
array $context

debug()

debug(string  $message, array  $context = []) : void

Detailed debug information.

Parameters

string $message
array $context

log()

log(mixed  $level, string  $message, array  $context = []) : void

Logs with an arbitrary level.

Parameters

mixed $level
string $message
array $context

__call()

__call(mixed  $method, mixed  $parameters) : mixed

Parameters

mixed $method
mixed $parameters

Returns

mixed —