123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990 |
- <?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));
- }
-
-
-
- else
- {
- $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]);
- }
- }
|