<commit_before><?php namespace Zephyrus\Security;

use Monolog\Handler\StreamHandler;
use Monolog\Logger;

class SystemLog
{
    /**
     * @param string $message
     */
    public static function addSecurity($message)
    {
        $stream = new StreamHandler(ROOT_DIR . '/logs/security.log');
        $logger = new Logger('security');
        $logger->pushHandler($stream);
        $logger->addAlert($message);
    }

    /**
     * @param string $message
     */
    public static function addError($message)
    {
        $stream = new StreamHandler(ROOT_DIR . '/logs/errors.log');
        $logger = new Logger('errors');
        $logger->pushHandler($stream);
        $logger->addAlert($message);
    }

    /**
     * @param string $message
     */
    public static function addVerbose($message)
    {
        $stream = new StreamHandler(ROOT_DIR . '/logs/verbose.log');
        $logger = new Logger('verbose');
        $logger->pushHandler($stream);
        $logger->addInfo($message);
    }
}<commit_msg>Updated formatting of system loggers and made them available from getters<commit_after><?php namespace Zephyrus\Security;

use Monolog\Formatter\LineFormatter;
use Monolog\Handler\StreamHandler;
use Monolog\Logger;

class SystemLog
{
    /**
     * @var Logger
     */
    private static $securityLogger;

    /**
     * @var Logger
     */
    private static $errorsLogger;

    /**
     * @var Logger
     */
    private static $verboseLogger;

    /**
     * @param string $message
     */
    public static function addSecurity($message)
    {
        self::buildSecurityLogger();
        self::$securityLogger->addAlert($message);
    }

    /**
     * @param string $message
     */
    public static function addError($message)
    {
        self::buildErrorsLogger();
        self::$errorsLogger->addAlert($message);
    }

    /**
     * @param string $message
     */
    public static function addVerbose($message)
    {
        self::buildVerboseLogger();
        self::$verboseLogger->addInfo($message);
    }

    /**
     * @return Logger
     */
    public static function getSecurityLogger()
    {
        self::buildSecurityLogger();
        return self::$securityLogger;
    }

    /**
     * @return Logger
     */
    public static function getErrorsLogger()
    {
        self::buildErrorsLogger();
        return self::$errorsLogger;
    }

    /**
     * @return Logger
     */
    public static function getVerboseLogger()
    {
        self::buildVerboseLogger();
        return self::$verboseLogger;
    }

    private static function buildSecurityLogger()
    {
        if (is_null(self::$securityLogger)) {
            $output = "[%datetime%] %message%\n";
            $formatter = new LineFormatter($output);
            $securityStream = new StreamHandler(ROOT_DIR . '/logs/security.log', Logger::WARNING);
            $securityStream->setFormatter($formatter);
            self::$securityLogger = new Logger('security');
            self::$securityLogger->pushHandler($securityStream);
        }
    }

    private static function buildErrorsLogger()
    {
        if (is_null(self::$securityLogger)) {
            $output = "[%datetime%] %level_name% : %message%\n";
            $formatter = new LineFormatter($output);
            $errorsStream = new StreamHandler(ROOT_DIR . '/logs/errors.log', Logger::INFO);
            $errorsStream->setFormatter($formatter);
            self::$errorsLogger = new Logger('errors');
            self::$errorsLogger->pushHandler($errorsStream);
        }
    }

    private static function buildVerboseLogger()
    {
        if (is_null(self::$securityLogger)) {
            $output = "[%datetime%] %level_name% : %message%\n";
            $formatter = new LineFormatter($output);
            $verboseStream = new StreamHandler(ROOT_DIR . '/logs/verbose.log', Logger::DEBUG);
            $verboseStream->setFormatter($formatter);
            self::$verboseLogger = new Logger('verbose');
            self::$verboseLogger->pushHandler($verboseStream);
        }
    }
}
{'fraction_non_alphanumeric': 0.1357354392892399, 'fraction_numerical': 0.0, 'mean_word_length': 2.42603550295858, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 18, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6326211', 'n_tokens_mistral': 1094, 'n_tokens_neox': 1084, 'n_words': 215}