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