12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485 |
- <?php namespace Laravel;
- class Log {
-
- public static function exception($e)
- {
- static::write('error', static::exception_line($e));
- }
-
- protected static function exception_line($e)
- {
- return $e->getMessage().' in '.$e->getFile().' on line '.$e->getLine();
- }
-
- public static function write($type, $message)
- {
-
-
-
- if (Event::listeners('laravel.log'))
- {
- Event::fire('laravel.log', array($type, $message));
- }
- $message = static::format($type, $message);
- File::append(path('storage').'logs/'.date('Y-m-d').'.log', $message);
- }
-
- protected static function format($type, $message)
- {
- return date('Y-m-d H:i:s').' '.Str::upper($type)." - {$message}".PHP_EOL;
- }
-
- public static function __callStatic($method, $parameters)
- {
- static::write($method, $parameters[0]);
- }
- }
|