public static function write_log($chain, $type, $file="", $line=""){
        /*if(filesize(PATHAPP . 'logs/log.txt') > 100000){           
            $arch= fopen(PATHAPP . 'logs/log.txt', "w");
            fclose($arch); 
        }*/
        $arch = fopen(PATHAPP . 'logs/log-' . date('Y-m-d') . '.txt', "a+"); 
        if(ENOLA_MODE == 'HTTP'){
            fwrite($arch, "[".date("Y-m-d H:i:s.u")." ".filter_input(INPUT_SERVER, 'REMOTE_ADDR')." "." - $type ] ".$chain." - $file - $line \n");
        }else{
            fwrite($arch, "[".date("Y-m-d H:i:s.u")." MODE CLI "." - $type ] ".$chain." - $file - $line \n");
        }
        fwrite($arch, "---------- \n");
        fclose($arch);
    }