Esempio n. 1
0
 public function errorLog()
 {
     $now = new \DateTime('now');
     $file = "log/" . $now->format("Y-m-d") . ".txt";
     try {
         $logs = FileSystem::get($file);
         $logs .= "Ref# : " . $this->reference . " || \t";
         $logs .= "Level : " . $this->level . "\n";
         $logs .= $now->format("Y-m-d h:i:s A") . " || \t";
         $logs .= "IP: " . GeoLocation::getIP() . " || \t";
         $logs .= "Country: " . GeoLocation::getCountry() . "\n";
         $logs .= GeoLocation::userAgent() . "\n";
         $logs .= "Error: " . $this->error . "\n";
         $logs .= "Debug Errors: " . $this->debugErrors . "\n";
         $logs .= "Error Location: " . $this->file . " in line " . $this->line . "\n";
         $logs .= "--------------------------------------------------------------------------------------------------------------------------\n";
         FileSystem::put($file, $logs);
     } catch (\Exception $e) {
         throw new \Exception($e->getMessage());
     }
 }
Esempio n. 2
0
 public static function log($log, $level = 1)
 {
     $ref = Etc::getRandomId();
     $now = new \DateTime('now');
     $file = "log/" . $now->format("Y-m-d") . ".txt";
     try {
         $logs = FileSystem::get($file);
         $logs .= "Ref# : " . $ref . " || \t";
         $logs .= "Level : " . $level . "\n";
         $logs .= $now->format("Y-m-d h:i:s A") . " || \t";
         $logs .= "IP: " . GeoLocation::getIP() . " || \t";
         $logs .= "Country: " . GeoLocation::getCountry() . "\n";
         $logs .= GeoLocation::userAgent() . "\n";
         $logs .= "Log: " . $log . "\n";
         $logs .= "--------------------------------------------------------------------------------------------------------------------------\n";
         FileSystem::put($file, $logs);
     } catch (\Exception $e) {
         throw new \Exception($e->getMessage());
     }
     return $ref;
 }