-
Notifications
You must be signed in to change notification settings - Fork 0
/
Log.php
47 lines (38 loc) · 844 Bytes
/
Log.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
<?php
use PHPFms\Log;
class MyLog extends \PHPFms\Template\LogEngine {
/** @var log file */
private $logfile;
/**
* Constructor
* Log constructor.
*/
public function __construct()
{
$this->logfile = new \PHPFms\File("test.log", "a+");
}
/**
* Error
* @param string $message
* @return bool
*/
public function error(string $message): bool
{
$this->logfile->write($message . "\n");
}
/**
* Info
* @param string $message
* @return bool
*/
public function info(string $message): bool
{
$this->logfile->write($message . "\n");
}
}
// Logger
$logger = new MyLog();
// Define log engine
Log::SetLogEngine($logger);
$dir = new \PHPFms\Directory("WEnoTeXisS");
$dir->writeFile("noFile.txt", "thisWilFail...");