\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 : 

Type

$logger

$logger : 

Type

$event

$event : 

Type

$lazy

$lazy : 

Type

$log

$log : array

日志信息

Type

array

$close

$close : array

关闭日志

Type

array

$allow

$allow : array

允许写入类型

Type

array

Methods

__construct()

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

Parameters

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

close()

close() 

关闭通道

clear()

clear() 

清空日志

record()

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

记录日志信息

Parameters

mixed $msg

日志信息

string $type

日志级别

array $context

替换内容

boolean $lazy

Returns

$this

write()

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

实时写入日志信息

Parameters

mixed $msg

调试信息

string $type

日志级别

array $context

替换内容

Returns

$this

getLog()

getLog() : array

获取日志信息

Returns

array

save()

save() : boolean

保存日志

Returns

boolean

emergency()

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

System is unusable.

Parameters

string $message
array $context

alert()

alert(string  $message, array  $context = array()) : 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 = array()) : void

Critical conditions.

Example: Application component unavailable, unexpected exception.

Parameters

string $message
array $context

error()

error(string  $message, array  $context = array()) : 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 = array()) : 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 = array()) : void

Normal but significant events.

Parameters

string $message
array $context

info()

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

Interesting events.

Example: User logs in, SQL logs.

Parameters

string $message
array $context

debug()

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

Detailed debug information.

Parameters

string $message
array $context

log()

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

Logs with an arbitrary level.

Parameters

mixed $level
string $message
array $context

__call()

__call(  $method,   $parameters) 

Parameters

$method
$parameters