Your IP : 216.73.216.229


Current Path : /home/jeromecohp/www/plugins/system/yooessentials/modules/core/src/
Upload File :
Current File : /home/jeromecohp/www/plugins/system/yooessentials/modules/core/src/Logger.php

<?php
/**
 * @package   Essentials YOOtheme Pro (Freemium) 2.0.19 build 1026.0920
 * @author    ZOOlanders https://www.zoolanders.com
 * @copyright Copyright (C) Joolanders, SL
 * @license   http://www.gnu.org/licenses/gpl.html GNU/GPL
 */

namespace ZOOlanders\YOOessentials;

class Logger extends Data
{
    /**
     * @var array
     */
    public static $loggers = [];

    public function __construct(string $id)
    {
        $this->id = $id;
        $this->entries = [];
    }

    public static function createLogger(string $id, string $group): self
    {
        self::$loggers[$group] = self::$loggers[$group] ?? [];

        if (isset(self::$loggers[$group][$id])) {
            return self::$loggers[$group][$id];
        }

        return self::$loggers[$group][$id] = new Logger($id);
    }

    public function logEntry(string $id, array $args): void
    {
        $this->data['entries'][] = compact('id') + $args;
    }
}