LogProviderFile
in package
implements
LogProviderInterface
Generic log file class to encapsulate common file I/O and rendering calls.
Tags
Table of Contents
Interfaces
- LogProviderInterface
- Interface that defines the methods required for a logging provider.
Properties
- $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.
Methods
- 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() : void
- Writes a line of data to the log.
- backupFile() : void
- 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
stringsetMaxSize()
Set the max log size in megabytes.
public
setMaxSize(int $maxSize) : mixed
Parameters
- $maxSize : int
Tags
setPath()
Set the file path.
public
setPath(string $path) : mixed
Parameters
- $path : string
Tags
writeLine()
Writes a line of data to the log.
public
writeLine(mixed $line) : void
Parameters
- $line : 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() : void
Tags
checkFileSize()
Returns the size in megabytes of the log file on disc.
private
checkFileSize() : int