Skip to content

Commit c2a3541

Browse files
committed
Add basic logger
1 parent ebd7206 commit c2a3541

File tree

1 file changed

+37
-0
lines changed

1 file changed

+37
-0
lines changed

src/php-bufflog/BuffLog.php

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,34 @@
1919

2020
class BuffLog {
2121

22+
private $logger;
23+
24+
public function debug($message)
25+
{
26+
$this->getLogger()->debug($message);
27+
}
28+
29+
public function info($message)
30+
{
31+
$this->getLogger()->info($message);
32+
}
33+
34+
public function warn($message)
35+
{
36+
$this->getLogger()->warn($message);
37+
}
38+
39+
40+
public function error($message)
41+
{
42+
$this->getLogger()->error($message);
43+
}
44+
45+
public function critical($message)
46+
{
47+
$this->getLogger()->critical($message);
48+
}
49+
2250
protected function createLogger()
2351
{
2452
$logger = new Logger('php-bufflog');
@@ -29,4 +57,13 @@ protected function createLogger()
2957
return $logger;
3058
}
3159

60+
public function getLogger()
61+
{
62+
if (!isset($this->logger)) {
63+
$this->logger = $this->createLogger();
64+
}
65+
66+
return $this->logger;
67+
}
68+
3269
}

0 commit comments

Comments
 (0)