getMessage().' in '.$e->getFile().' on line '.$e->getLine(); } /** * Write a message to the log file. * * * // Write an "error" messge to the log file * Log::write('error', 'Something went horribly wrong!'); * * // Write an "error" message using the class' magic method * Log::error('Something went horribly wrong!'); * * * @param string $type * @param string $message * @return void */ public static function write($type, $message) { $message = date('Y-m-d H:i:s').' '.Str::upper($type)." - {$message}".PHP_EOL; File::append(path('storage').'logs/'.date('Y-m-d').'.log', $message); } /** * Dynamically write a log message. * * * // Write an "error" message to the log file * Log::error('This is an error!'); * * // Write a "warning" message to the log file * Log::warning('This is a warning!'); * */ public static function __callStatic($method, $parameters) { static::write($method, $parameters[0]); } }