2020-03-12 05:29:08 +09:00
|
|
|
<?php
|
2020-03-16 06:21:11 +09:00
|
|
|
|
2020-03-22 05:18:05 +09:00
|
|
|
/*
|
|
|
|
* This file is part of GNU social - https://www.gnu.org/software/social
|
|
|
|
*
|
|
|
|
* GNU social is free software: you can redistribute it and/or modify
|
|
|
|
* it under the terms of the GNU Affero General Public License as published by
|
|
|
|
* the Free Software Foundation, either version 3 of the License, or
|
|
|
|
* (at your option) any later version.
|
|
|
|
*
|
|
|
|
* GNU social is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
* GNU Affero General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU Affero General Public License
|
|
|
|
* along with GNU social. If not, see <http://www.gnu.org/licenses/>.
|
|
|
|
*/
|
|
|
|
|
|
|
|
/**
|
|
|
|
* GNU social's logger wrapper around Symfony's,
|
|
|
|
* keeping our old static interface, which is more convenient and just as powerful
|
|
|
|
*
|
|
|
|
* @package GNUsocial
|
|
|
|
* @category Log
|
|
|
|
*
|
|
|
|
* @author Hugo Sales <hugo@fc.up.pt>
|
|
|
|
* @copyright 2020 Free Software Foundation, Inc http://www.fsf.org
|
|
|
|
* @license https://www.gnu.org/licenses/agpl.html GNU AGPL v3 or later
|
|
|
|
*/
|
|
|
|
|
2020-05-12 03:15:08 +09:00
|
|
|
namespace App\Core;
|
2020-03-12 05:29:08 +09:00
|
|
|
|
|
|
|
use Psr\Log\LoggerInterface;
|
|
|
|
|
|
|
|
class Log
|
|
|
|
{
|
|
|
|
private static ?LoggerInterface $logger;
|
|
|
|
|
|
|
|
public static function setLogger($l): void
|
|
|
|
{
|
|
|
|
self::$logger = $l;
|
|
|
|
}
|
2020-03-16 06:21:11 +09:00
|
|
|
|
2020-03-22 05:18:05 +09:00
|
|
|
/**
|
|
|
|
* Simple static wrappers around Monolog's functions
|
2020-05-12 03:15:08 +09:00
|
|
|
*
|
2020-05-11 05:43:15 +09:00
|
|
|
* @param string $msg
|
2020-03-22 05:18:05 +09:00
|
|
|
*/
|
|
|
|
public static function emergency(string $msg): void
|
|
|
|
{
|
|
|
|
self::$logger->emergency($msg);
|
|
|
|
}
|
|
|
|
|
2020-05-11 05:43:15 +09:00
|
|
|
/**
|
|
|
|
* @param string $msg
|
|
|
|
*/
|
2020-03-22 05:18:05 +09:00
|
|
|
public static function alert(string $msg): void
|
|
|
|
{
|
|
|
|
self::$logger->alert($msg);
|
|
|
|
}
|
|
|
|
|
2020-05-11 05:43:15 +09:00
|
|
|
/**
|
|
|
|
* @param string $msg
|
|
|
|
*/
|
2020-03-22 05:18:05 +09:00
|
|
|
public static function critical(string $msg): void
|
|
|
|
{
|
|
|
|
self::$logger->critical($msg);
|
|
|
|
}
|
|
|
|
|
2020-05-11 05:43:15 +09:00
|
|
|
/**
|
|
|
|
* @param string $msg
|
|
|
|
*/
|
2020-03-12 05:29:08 +09:00
|
|
|
public static function error(string $msg): void
|
|
|
|
{
|
|
|
|
self::$logger->error($msg);
|
|
|
|
}
|
2020-03-16 06:21:11 +09:00
|
|
|
|
2020-05-11 05:43:15 +09:00
|
|
|
/**
|
|
|
|
* @param string $msg
|
|
|
|
*/
|
2020-03-22 05:18:05 +09:00
|
|
|
public static function warning(string $msg): void
|
|
|
|
{
|
|
|
|
self::$logger->warning($msg);
|
|
|
|
}
|
|
|
|
|
2020-05-11 05:43:15 +09:00
|
|
|
/**
|
|
|
|
* @param string $msg
|
|
|
|
*/
|
2020-03-22 05:18:05 +09:00
|
|
|
public static function notice(string $msg): void
|
|
|
|
{
|
|
|
|
self::$logger->notice($msg);
|
|
|
|
}
|
|
|
|
|
2020-05-11 05:43:15 +09:00
|
|
|
/**
|
|
|
|
* @param string $msg
|
|
|
|
*/
|
2020-03-12 05:29:08 +09:00
|
|
|
public static function info(string $msg): void
|
|
|
|
{
|
|
|
|
self::$logger->info($msg);
|
|
|
|
}
|
2020-03-16 06:21:11 +09:00
|
|
|
|
2020-05-11 05:43:15 +09:00
|
|
|
/**
|
|
|
|
* @param string $msg
|
|
|
|
*/
|
2020-03-12 05:29:08 +09:00
|
|
|
public static function debug(string $msg): void
|
|
|
|
{
|
2020-05-11 05:43:15 +09:00
|
|
|
self::$logger->debug($msg);
|
2020-03-12 05:29:08 +09:00
|
|
|
}
|
|
|
|
}
|