File adapter.
Constructor.
| Type | Description |
|---|---|
| array | Configuration |
NULL
public function __construct(array $config)
{
$this->path = $config['path'];
}
Writes message to log.
| Type | Description |
|---|---|
| string | The message to write to the log |
| int | (optional) Message type |
boolean TRUE on success or FALSE on failure.
public function write($message, $type = Log::ERROR)
{
$file = rtrim($this->path, '/') . '/' . $this->types[$type] . '_' . gmdate('Y_m_d') . '.log';
$message = '[' . gmdate('d-M-Y H:i:s') . '] ' . $message . PHP_EOL;
return (bool) file_put_contents($file, $message, FILE_APPEND);
}