Class FileLog
File Storage stream for Logging. Writes logs to different files based on the type of log it is.
- BaseLog implements CakeLogInterface
- FileLog
Package: Cake\Log\Engine
Copyright: Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org)
License: MIT License
Located at Cake/Log/Engine/FileLog.php
Copyright: Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org)
License: MIT License
Located at Cake/Log/Engine/FileLog.php
Method Detail
__constructsource public
__construct( array $config array() )
Constructs a new File Logger.
Config
-
types
string or array, levels the engine is interested in -
scopes
string or array, scopes the engine is interested in -
file
Log file name -
path
The path to save logs on. -
size
Used to implement basic log file rotation. If log file size reaches specified size the existing file is renamed by appending timestamp to filename and new log file is created. Can be integer bytes value or human reabable string values like '10MB', '100KB' etc. -
rotate
Log files are rotated specified times before being removed. If value is 0, old versions are removed rather then rotated. -
mask
A mask is applied when log files are created. Left empty no chmod is made.
Parameters
- array
$config
optional array() - Options for the FileLog, see above.
Overrides
BaseLog::__construct()
_getFilenamesource protected
_getFilename( string $type )
Get filename
Parameters
- string
$type
- The type of log.
Returns
string
File name
_rotateFilesource protected
_rotateFile( string $filename )
Rotate log file if size specified in config is reached. Also if rotate
count is reached oldest file is removed.
Parameters
- string
$filename
- Log file name
Returns
mixed
True if rotated successfully or false in case of error, otherwise null. Void if file doesn't need to be rotated.
configsource public
config( array $config array() )
Sets protected properties based on config provided
Parameters
- array
$config
optional array() - Engine configuration
Returns
array
array
Overrides
BaseLog::config()
writesource public
write( string $type , string $message )
Implements writing to log files.
Parameters
- string
$type
- The type of log you are making.
- string
$message
- The message you want to log.
Returns
boolean
success of write.
Properties summary
Properties inherited from BaseLog
© 2005–2016 The Cake Software Foundation, Inc.
Licensed under the MIT License.
CakePHP is a registered trademark of Cake Software Foundation, Inc.
We are not endorsed by or affiliated with CakePHP.
http://api.cakephp.org/2.7/class-FileLog.html