1: | <?php |
2: | /** |
3: | * @package OpenCart |
4: | * |
5: | * @author Daniel Kerr |
6: | * @copyright Copyright (c) 2005 - 2022, OpenCart, Ltd. (https://www.opencart.com/) |
7: | * @license https://opensource.org/licenses/GPL-3.0 |
8: | * |
9: | * @see https://www.opencart.com |
10: | */ |
11: | namespace Opencart\System\Library; |
12: | /** |
13: | * Class Log |
14: | */ |
15: | class Log { |
16: | /** |
17: | * @var string |
18: | */ |
19: | private string $file; |
20: | |
21: | /** |
22: | * Constructor |
23: | * |
24: | * @param string $filename |
25: | */ |
26: | public function __construct(string $filename) { |
27: | $this->file = DIR_LOGS . $filename; |
28: | } |
29: | |
30: | /** |
31: | * Write |
32: | * |
33: | * @param mixed $message |
34: | * |
35: | * @return void |
36: | */ |
37: | public function write($message): void { |
38: | file_put_contents($this->file, date('Y-m-d H:i:s') . ' - ' . print_r($message, true) . "\n", FILE_APPEND); |
39: | } |
40: | } |
41: |