Update logger dependencies and add Logger class
This commit is contained in:
parent
f8e5b0f632
commit
d702ddb120
3 changed files with 33 additions and 4 deletions
28
src/TgBotLib/Classes/Logger.php
Normal file
28
src/TgBotLib/Classes/Logger.php
Normal 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;
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue