<?php
/********************************************************************************
 * (c)1337 aheadware.com - All rights reserved
 ********************************************************************************/


class TB_Server_Utils_Log {

    // Privates
    private static $logger = NULL;
    private static $cronLogger = NULL;

    // List of error codes which should not be logged
    static public $noLogCodes = array(
        TB_Server_Core_Response::CODE_OUTDATED_VERSION,
        TB_Server_Core_Response::CODE_NOT_LOGGED_IN
    );

    /**
     * Get default logger
     *
     * @return Francis_Utils_Log|null
     */
    public static function get() {
        if ( is_null( self::$logger ) ) {
            self::$logger = new Francis_Utils_Log(
                Francis_Utils_Config::get( 'path.logfile' ),
                Francis_Utils_Config::get( 'slack.logWebhook')
            );
        }
        return self::$logger;
    }

    /**
     * Get cron logger
     *
     * @return Francis_Utils_Log|null
     */
    public static function getCron() {
        if ( is_null( self::$cronLogger) ) {
            self::$cronLogger = new Francis_Utils_Log( Francis_Utils_Config::get( 'path.cron_logfile' ) );
        }
        return self::$cronLogger;
    }
} 