FrostMVC\Logs
use FrostMVC\Logs;
Simple file-based logging utility.
Log files are written to the directory configured via setDirectory(); if none is set, the directory of the PHP error_log INI path is used. File names are based on the given name plus a '.log' extension; when no name is specified, today's date in 'Y_m_d' format is used.
| ::getDirectory() | Returns the configured log directory, or false when no directory has been set. |
| ::read() | Reads the full contents of a log file as a string. When no filename is given, reads today's date log. Returns an empty string when the file does not exist. |
| ::setDirectory() | Sets the directory where log files are written. Pass a full path without a trailing separator. |
| ::write() | Appends a timestamped message to a log file. When only one argument is given, the message is logged to today's date file. |
Logs::getDirectory()
Returns the configured log directory, or false when no directory has been set.
string|false
Logs::read($file = false)
Reads the full contents of a log file as a string. When no filename is given, reads today's date log. Returns an empty string when the file does not exist.
| $file | string|false |
The log filename (without '.log'), or false for today's log. Default:false |
string
Logs::setDirectory($directory)
Sets the directory where log files are written. Pass a full path without a trailing separator.
| $directory | string |
Logs::write($file, $value = false)
Appends a timestamped message to a log file. When only one argument is given, the message is logged to today's date file.
| $file | string |
The log filename (without '.log') or the message when used as the sole argument. |
| $value | string|false |
The message, or false to treat $file as the message. Default:false |
Generated from core/classes/Logs.php (FrostMVC ).