Update logger dependencies and add Logger class

This commit is contained in:
netkas 2024-11-01 14:01:25 -04:00
parent f8e5b0f632
commit d702ddb120
3 changed files with 33 additions and 4 deletions

View file

@ -0,0 +1,28 @@
<?php
namespace TgBotLib\Classes;
use LogLib\Log;
class Logger
{
private static ?\LogLib\Logger $logger = null;
/**
* Retrieves the instance of the logger. If the logger instance does not
* exist, it initializes a new logger for the application and registers
* the exception handler.
*
* @return \LogLib\Logger The logger instance.
*/
public static function getLogger(): \LogLib\Logger
{
if(self::$logger === null)
{
self::$logger = new \LogLib\Logger('net.nosial.tgbotlib');
Log::registerExceptionHandler();
}
return self::$logger;
}
}