<commit_before><?php

    class Console {
        /**
         * Logs array (saved on register)
        **/
        private static $logs        = array();
        
        /**
         * Console configuration
        **/
        const ERRORS_REPORTING      = E_ALL;
        const LOGS_FORMAT           = '[:time] [:type] :message';
        
        
        /**
         * Logs types
        **/
        const LOG_DEFAULT       = 'DEFAULT'; // Default log
        const LOG_ERROR         = 'ERROR'; // Error
        const LOG_WARNING       = 'WARNING'; // 
        const LOG_NOTICE        = 'NOTICE';
        const LOG_DEPRECATED    = 'DEPRECATED';
        const LOG_DEBUG         = 'DEBUG';
        
        
        /**
         * Redefine logs format
        **/
        public static function handle() {
            if(!SYSTEM_DEBUG) // Run Console errors handler
                set_error_handler('Console::handler');
            
            error_reporting(Console::ERRORS_REPORTING);
            register_shutdown_function('Console::register');
        }
        
        public static function handler($type, $message, $file, $line){
            if(!(error_reporting() & $type)) return;
            
            switch ($type) {
                case E_USER_ERROR:
                    Console::fatal("$message in $file : line $line");
                    break;
                            
                case E_USER_WARNING:
                    Console::warning("$message in $file : line $line");
                    break;
                    
                case E_USER_NOTICE:
                    Console::notice("$message in $file : line $line");
                    break;
                
                case E_USER_DEPRECATED:
                    Console::deprecated("$message in $file : line $line");
                    break;
                    
                default:
                    Console::log("$message in $file : line $line", Console::LOG_ERROR);
            }

            return true;
        }
        <commit_msg>Console : transform non caught exceptions as notice errors<commit_after><?php

    class Console {
        /**
         * Logs array (saved on register)
        **/
        private static $logs        = array();
        
        /**
         * Console configuration
        **/
        const ERRORS_REPORTING      = E_ALL;
        const LOGS_FORMAT           = '[:time] [:type] :message';
        
        
        /**
         * Logs types
        **/
        const LOG_DEFAULT       = 'DEFAULT'; // Default log
        const LOG_ERROR         = 'ERROR'; // Error
        const LOG_WARNING       = 'WARNING'; // 
        const LOG_NOTICE        = 'NOTICE';
        const LOG_DEPRECATED    = 'DEPRECATED';
        const LOG_DEBUG         = 'DEBUG';
        
        
        /**
         * Redefine logs format
        **/
        public static function handle() {
            error_reporting(Console::ERRORS_REPORTING);
            
            if(!SYSTEM_DEBUG) // Run Console errors handler
                set_error_handler('Console::handler');
               
            set_exception_handler('Console::exception');
            register_shutdown_function('Console::register');
        }
        
        /**
         * Prevent exceptions errors
         * Generate a notice error
        **/
        public static function exception($e) {
            trigger_error($e, E_USER_NOTICE);
        }
        
        /**
         * Handle errors
        **/
        public static function handler($type, $message, $file, $line){
            if(!(error_reporting() & $type)) return;
            
            switch ($type) {
                case E_USER_ERROR:
                    Console::fatal("$message in $file : line $line");
                    break;
                            
                case E_USER_WARNING:
                    Console::warning("$message in $file : line $line");
                    break;
                    
                case E_USER_NOTICE:
                    Console::notice("$message in $file : line $line");
                    break;
                
                case E_USER_DEPRECATED:
                    Console::deprecated("$message in $file : line $line");
                    break;
                    
                default:
                    Console::log("$message in $file : line $line", Console::LOG_ERROR);
            }

            return true;
        }
        
{'fraction_non_alphanumeric': 0.09930819013613033, 'fraction_numerical': 0.0, 'mean_word_length': 1.1261859582542695, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 3, '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': '757290', 'n_tokens_mistral': 1103, 'n_tokens_neox': 1058, 'n_words': 249}