标签:
composer create-project laravel/laravel=4.2.* “项目名” --prefer-dist
"autoload": {
"classmap": [
"database"
,"app/library/class"
],
"psr-4": {
"App\\": "app/"
}
},
class SPLogger { // 所有的LOG都要求在这里注册 const LOG_ERROR = ‘error‘; const LOG_INFO = ‘info‘; const LOG_DEBUG = ‘debug‘; const LOG_SQL = ‘sql‘; private static $loggers = array(); // 获取一个实例 public static function getLogger($type = self::LOG_ERROR, $day = 30) { if (empty(self::$loggers[$type])) { self::$loggers[$type] = new Writer(new Logger($type)); // self::$loggers[$type]->useDailyFiles(‘/usr/local/SpManaPlat‘.‘/logs/‘. $type .‘.log‘, $day); self::$loggers[$type]->useDailyFiles(storage_path().‘/logs/‘. $type .‘.log‘, $day); } $log = self::$loggers[$type]; return $log; } }
Class PublicAPI { public static function log($log_string) { // $action = Route::current()->getActionName(); // list($class, $method) = explode(‘@‘, $action);//字符串分割 $log = [ ‘message‘ => $log_string, //消息 ‘url‘ => Request::url(), //当前地址 ‘input‘ => Input::all(), //输入参数 ‘time‘ => date(‘Y-m-d H:i:s‘), //时间 ]; SPLogger::getLogger(SPLogger::LOG_DEBUG)->debug($log); } }
标签:
原文地址:http://www.cnblogs.com/huangdahai/p/5862464.html