File
extends DestinationBase
in package
Appends log data to a file.
Use the 'file_name' parameter in the open param array.
Table of Contents
Properties
- $_file : mixed
- $_filters : array<string|int, mixed>
- $_format : IFormat
- $_name : string
- $_parent : ILogger|null
- $_stdErr : mixed
- $_stdOut : mixed
Methods
- __construct() : mixed
- addFilter() : bool
- Adds a logging filter.
- buildFileName() : string
- Returns either the normal file name or replaces %DATE% with the current date for example: 2021-06-03.log
- close() : void
- Closes the open file handle associated with the log file.
- getFileName() : string
- getParent() : ILogger
- Gets the parent logger.
- getStdErr() : mixed
- getStdOut() : mixed
- log() : void
- Handles writing the log data after filtering and formatting.
- open() : bool
- Opens the destination. Destinations may require parameters to be passed in.
- removeFilter() : bool
- Removes a logging filter.
- setFileHandles() : void
- Maps STDERR and STDOUT to file handles in non-CLI environments.
- setFormat() : void
- Sets the formatter.
- setParent() : void
- Sets the parent logger.
- write() : void
- Writes the formatted log data to the specific destination.
Properties
$_file
private
mixed
$_file
$_filters
private
array<string|int, mixed>
$_filters
= []
$_format
private
IFormat
$_format
$_name
private
string
$_name
$_parent
private
ILogger|null
$_parent
= null
$_stdErr
private
mixed
$_stdErr
$_stdOut
private
mixed
$_stdOut
Methods
__construct()
public
__construct(IFormat $format) : mixed
Parameters
- $format : IFormat
addFilter()
Adds a logging filter.
public
addFilter(IFilter $filter) : bool
Parameters
- $filter : IFilter
Return values
boolbuildFileName()
Returns either the normal file name or replaces %DATE% with the current date for example: 2021-06-03.log
public
buildFileName(string $mask) : string
Parameters
- $mask : string
Return values
stringclose()
Closes the open file handle associated with the log file.
public
close() : void
getFileName()
public
getFileName() : string
Return values
stringgetParent()
Gets the parent logger.
public
getParent() : ILogger
Return values
ILoggergetStdErr()
public
getStdErr() : mixed
getStdOut()
public
getStdOut() : mixed
log()
Handles writing the log data after filtering and formatting.
public
log(mixed $text, mixed $level[, mixed $context = [] ]) : void
Parameters
- $text : mixed
-
- Output that has been run through the formatter.
- $level : mixed
-
- Text output level.
- $context : mixed = []
-
- Optional context array
open()
Opens the destination. Destinations may require parameters to be passed in.
public
open(array<string|int, mixed> $params) : bool
Parameters
- $params : array<string|int, mixed>
-
[ 'file_name' => string ]
Return values
boolremoveFilter()
Removes a logging filter.
public
removeFilter(IFilter $removeFilter) : bool
Parameters
- $removeFilter : IFilter
Return values
boolsetFileHandles()
Maps STDERR and STDOUT to file handles in non-CLI environments.
public
setFileHandles() : void
setFormat()
Sets the formatter.
public
setFormat(IFormat $format) : void
Parameters
- $format : IFormat
setParent()
Sets the parent logger.
public
setParent(ILogger $logger) : void
Parameters
- $logger : ILogger
write()
Writes the formatted log data to the specific destination.
public
write(string $text, Data $data) : void
Parameters
- $text : string
- $data : Data