LogProviderFile implements LogProviderInterface
Generic log file class to encapsulate common file I/O and rendering calls.
Tags
Interfaces, Classes and Traits
- LogProviderInterface
- Interface that defines the methods required for a logging provider.
Table of Contents
- $maxSize : int
- The maximum size of the log file in megabytes before a backup is created and a new file is created, default is 5.
- $path : string
- The log file path.
- renderLog() : string
- Renders a log as a HTML table.
- setMaxSize() : mixed
- Set the max log size in megabytes.
- setPath() : mixed
- Set the file path.
- writeLine() : mixed
- Writes a line of data to the log.
- backupFile() : mixed
- Creates a backup of the log file, which has the same file name and location as the current file plus a timestamp appended.
- checkFileSize() : int
- Returns the size in megabytes of the log file on disc.
Properties
$maxSize
The maximum size of the log file in megabytes before a backup is created and a new file is created, default is 5.
private
int
$maxSize
= 5
Tags
$path
The log file path.
private
string
$path
Tags
Methods
renderLog()
Renders a log as a HTML table.
public
renderLog(mixed $cols) : string
Parameters
- $cols : mixed
-
The headings to use when rendering the log.
Return values
string —setMaxSize()
Set the max log size in megabytes.
public
setMaxSize(int $maxSize) : mixed
Parameters
- $maxSize : int
Tags
Return values
mixed —setPath()
Set the file path.
public
setPath(string $path) : mixed
Parameters
- $path : string
Tags
Return values
mixed —writeLine()
Writes a line of data to the log.
public
writeLine(mixed $line) : mixed
Parameters
- $line : mixed
Return values
mixed —backupFile()
Creates a backup of the log file, which has the same file name and location as the current file plus a timestamp appended.
private
backupFile() : mixed
Tags
Return values
mixed —checkFileSize()
Returns the size in megabytes of the log file on disc.
private
checkFileSize() : int