<?php

namespace Opentalent\OtCore\Logging;

use Psr\Log\LoggerAwareInterface;
use Psr\Log\LoggerAwareTrait;
use TYPO3\CMS\Core\Log\LogLevel;
use TYPO3\CMS\Core\Utility\GeneralUtility;

class OtLogger implements LoggerAwareInterface
{
    use LoggerAwareTrait;

    public static function log(string $level, string $msg, array $context = []) {
        $loggerService = GeneralUtility::makeInstance(self::class);
        $loggerService->getLogger()->log($level, $msg, $context);
    }

    public function getLogger() {
        return $this->logger;
    }

    public static function alert(string $msg, array $context = []) {
        self::log(LogLevel::ALERT, $msg, $context);
    }

    public static function critical(string $msg, array $context = []) {
        self::log(LogLevel::CRITICAL, $msg, $context);
    }

    public static function error(string $msg, array $context = []) {
        self::log(LogLevel::ERROR, $msg, $context);
    }

    public static function warning(string $msg, array $context = []) {
        self::log(LogLevel::WARNING, $msg, $context);
    }

    public static function notice(string $msg, array $context = []) {
        self::log(LogLevel::NOTICE, $msg, $context);
    }

    public static function info(string $msg, array $context = []) {
        self::log(LogLevel::INFO, $msg, $context);
    }

    public static function debug(string $msg, array $context = []) {
        self::log(LogLevel::DEBUG, $msg, $context);
    }



}
