Comparing version 0.1.12 to 0.1.13
35
index.js
@@ -388,20 +388,4 @@ var fs = require('fs'), | ||
if (this.opts['IS_JSON']) { | ||
const caller = callsites()[3]; | ||
const callerFileName = caller.getFileName(); | ||
const callerFunctionName = caller.getFunctionName(); | ||
console.log( | ||
JSON.stringify({ | ||
level: this.params['current_level'], | ||
msg: options['msg'], | ||
file: callerFileName, | ||
function: callerFunctionName, | ||
uri: this.params['REQUEST_URI'] || '' | ||
}) | ||
); | ||
return; | ||
} | ||
var format = log_format || this.format['DEFAULT']; | ||
var str = this.getLogString(format); | ||
var str = this.getLogString(format, options); | ||
if (!str) { | ||
@@ -460,3 +444,18 @@ return false; | ||
*/ | ||
getLogString: function (format) { | ||
getLogString: function (format, options) { | ||
if (this.opts['IS_JSON']) { | ||
const caller = callsites()[3]; | ||
const callerFileName = caller.getFileName(); | ||
const callerFunctionName = caller.getFunctionName(); | ||
return ( | ||
JSON.stringify({ | ||
level: this.params['current_level'], | ||
msg: options['msg'], | ||
file: callerFileName, | ||
function: callerFunctionName, | ||
uri: this.params['REQUEST_URI'] || '' | ||
}) + '\n' | ||
); | ||
} | ||
if (!format) { | ||
@@ -463,0 +462,0 @@ return false; |
{ | ||
"name": "yog-log", | ||
"version": "0.1.12", | ||
"description": "yog logger", | ||
"main": "index.js", | ||
"scripts": { | ||
"test": "echo \"Error: no test specified\" && exit 1" | ||
}, | ||
"repository": { | ||
"type": "git", | ||
"url": "https://github.com/fex-team/yog-log.git" | ||
}, | ||
"dependencies": { | ||
"callsites": "^3.1.0", | ||
"colors": "0.6.2", | ||
"fast-strftime": "1.1.1", | ||
"mkdirp": "0.5.0", | ||
"stack-trace": "0.0.9" | ||
}, | ||
"keywords": [ | ||
"fis", | ||
"yog", | ||
"express", | ||
"kraken-js" | ||
], | ||
"author": "fansekey", | ||
"license": "BSD", | ||
"bugs": { | ||
"url": "https://github.com/fex-team/yog-log/issues" | ||
}, | ||
"homepage": "https://github.com/fex-team/yog-log" | ||
"name": "yog-log", | ||
"version": "0.1.13", | ||
"description": "yog logger", | ||
"main": "index.js", | ||
"scripts": { | ||
"test": "echo \"Error: no test specified\" && exit 1" | ||
}, | ||
"repository": { | ||
"type": "git", | ||
"url": "https://github.com/fex-team/yog-log.git" | ||
}, | ||
"dependencies": { | ||
"callsites": "^3.1.0", | ||
"colors": "0.6.2", | ||
"fast-strftime": "1.1.1", | ||
"mkdirp": "0.5.0", | ||
"stack-trace": "0.0.9" | ||
}, | ||
"keywords": [ | ||
"fis", | ||
"yog", | ||
"express", | ||
"kraken-js" | ||
], | ||
"author": "fansekey", | ||
"license": "BSD", | ||
"bugs": { | ||
"url": "https://github.com/fex-team/yog-log/issues" | ||
}, | ||
"homepage": "https://github.com/fex-team/yog-log" | ||
} |
75115
1337