Comparing version 0.1.4 to 0.1.5
20
index.js
var fs = require('fs'), | ||
path = require('path'), | ||
domain = require('domain'), | ||
url = require('url'), | ||
crypto = require('crypto'); | ||
@@ -252,3 +253,3 @@ | ||
this.params['SERVER_PORT'] = req.app.settings ? req.app.settings.port : ''; | ||
this.params['QUERY_STRING'] = req.query; | ||
this.params['QUERY_STRING'] = this.getQueryString(req.originalUrl); | ||
this.params['REQUEST_URI'] = req.originalUrl; | ||
@@ -268,2 +269,19 @@ this.params['REQUEST_PATHNAME'] = req._parsedUrl ? req._parsedUrl.pathname : '-'; | ||
/** | ||
* 获取请求的querystring | ||
* | ||
* @param {string} url 请求 url | ||
* @return {string} querystring | ||
*/ | ||
getQueryString(rawUrl) { | ||
try { | ||
var urlObj = url.parse(rawUrl); | ||
return urlObj.query || ''; | ||
} | ||
catch (e) { | ||
console.log(e); | ||
} | ||
return ''; | ||
}, | ||
/** | ||
* ODP环境下日志的前缀为AppName,非ODP环境需要配置指定前缀 | ||
@@ -270,0 +288,0 @@ * @return {[string]} [description] |
{ | ||
"name": "yog-log", | ||
"version": "0.1.4", | ||
"version": "0.1.5", | ||
"description": "yog logger", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
1309
72971
12