diff options
Diffstat (limited to 'src/Log.php')
-rw-r--r-- | src/Log.php | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/src/Log.php b/src/Log.php new file mode 100644 index 0000000..fce455f --- /dev/null +++ b/src/Log.php @@ -0,0 +1,27 @@ +<?php + + +namespace Micropoly; + + +use Monolog\Handler\ErrorLogHandler; +use Monolog\Logger; +use Psr\Log\LoggerInterface; + +class Log +{ + public static function logger(): LoggerInterface + { + static $logger = null; + if ($logger === null) + $logger = self::initLogger(); + return $logger; + } + + private static function initLogger(): Logger + { + $logger = new Logger("logger"); + $logger->pushHandler(new ErrorLogHandler()); + return $logger; + } +}
\ No newline at end of file |