| 1 | <?php |
||
| 2 | namespace Ackintosh\Snidel; |
||
| 3 | |||
| 4 | class Log |
||
| 5 | { |
||
| 6 | /** @var int */ |
||
| 7 | private $ownerPid; |
||
| 8 | |||
| 9 | /** @var resource */ |
||
| 10 | private $destination; |
||
| 11 | |||
| 12 | /** |
||
| 13 | * @param int $ownerPid |
||
| 14 | */ |
||
| 15 | public function __construct($ownerPid) |
||
| 19 | |||
| 20 | /** |
||
| 21 | * sets the resource for the log. |
||
| 22 | * |
||
| 23 | * @param resource $resource |
||
| 24 | * @return void |
||
| 25 | */ |
||
| 26 | public function setDestination($resource) |
||
| 30 | |||
| 31 | /** |
||
| 32 | * writes log |
||
| 33 | * |
||
| 34 | * @param string $type |
||
| 35 | * @param string $message |
||
| 36 | * @return void |
||
| 37 | */ |
||
| 38 | private function write($type, $message) |
||
| 56 | |||
| 57 | /** |
||
| 58 | * writes log |
||
| 59 | * |
||
| 60 | * @param string $message |
||
| 61 | * @return void |
||
| 62 | */ |
||
| 63 | public function info($message) |
||
| 67 | |||
| 68 | /** |
||
| 69 | * writes log |
||
| 70 | * |
||
| 71 | * @param string $message |
||
| 72 | * @return void |
||
| 73 | */ |
||
| 74 | public function error($message) |
||
| 75 | { |
||
| 76 | $this->write('error', $message); |
||
| 77 | } |
||
| 79 |