\PhalApi_Logger_File

PhalApi_Logger_File 文件日记纪录类

  • 将日记写入文件,文件目录可以自定义


使用示例:

     //目录为./Runtime,且保存全部类型的日记
     $logger = new PhalApi_Logger_File('./Runtime',
            PhalApi_Logger::LOG_LEVEL_DEBUG | PhalApi_Logger::LOG_LEVEL_INFO | PhalApi_Logger::LOG_LEVEL_ERROR);

     //日记会保存在在./Runtime/debug_log/目录下
     $logger->debug('this is bebug test');

Summary

Methods
Properties
Constants
__construct()
log()
info()
debug()
error()
No public properties found
LOG_LEVEL_DEBUG
LOG_LEVEL_INFO
LOG_LEVEL_ERROR
isAllowToLog()
init()
$logLevel
$logFolder
$dateFormat
$fileDate
$logFile
N/A
No private methods found
No private properties found
N/A

Constants

LOG_LEVEL_DEBUG

LOG_LEVEL_DEBUG

LOG_LEVEL_INFO

LOG_LEVEL_INFO

LOG_LEVEL_ERROR

LOG_LEVEL_ERROR

Properties

$logLevel

$logLevel : integer

Type

integer — log level, can be multi

$logFolder

$logFolder : 

外部传参 *

Type

$dateFormat

$dateFormat : 

Type

$fileDate

$fileDate : 

内部状态 *

Type

$logFile

$logFile : 

Type

Methods

__construct()

__construct(  $logFolder,   $level,   $dateFormat = 'Y-m-d H:i:s') 

Parameters

$logFolder
$level
$dateFormat

log()

log(string  $type, string  $msg, \string/array  $data) : NULL

Record log

wtite the log into different storage medium according your need

Parameters

string $type

the type of log, such as info, debug, error, etc.

string $msg

key description of log

\string/array $data

infomation of the context

Returns

NULL

info()

info(string  $msg, \string/array  $data = NULL) : NULL

The logs in production level

Parameters

string $msg

key description of log

\string/array $data

infomation of the context

Returns

NULL

debug()

debug(string  $msg, \string/array  $data = NULL) : NULL

The logs in debugger level

Parameters

string $msg

key description of log

\string/array $data

infomation of the context

Returns

NULL

error()

error(string  $msg, \string/array  $data = NULL) : NULL

The logs in system error level

Parameters

string $msg

key description of log

\string/array $data

infomation of the context

Returns

NULL

isAllowToLog()

isAllowToLog(integer  $logLevel) : boolean

Is allowed to write into or not, arithmetic or operation

Parameters

integer $logLevel

Returns

boolean

init()

init()