crawler-ninja-logger
Advanced tools
Comparing version 1.0.0 to 1.0.2
33
index.js
var fs = require("fs") | ||
var bunyan = require("bunyan"); | ||
/** | ||
* Common method to log used by the crawler and if needed by plugins | ||
* Ideally, the log json structure should contains the following attributes : | ||
* - url (can be null for specific crawl steps). | ||
* - step | ||
* - message | ||
* - options | ||
* | ||
*/ | ||
var infoFile = process.cwd() + "/logs/crawler.log"; | ||
var debugFile = process.cwd() + "/logs/debug.log"; | ||
var logFolder = process.cwd() + "/logs" ; | ||
if (! fs.existsSync(logFolder)) { | ||
fs.mkdirSync(logFolder); | ||
} | ||
var infoFile = logFolder + "/crawler.log"; | ||
var debugFile = logFolder + "/logs/debug.log"; | ||
console.log("Use info log in : " + infoFile); | ||
console.log("Use debug log in : " + debugFile); | ||
/** | ||
* Default logger | ||
* | ||
*/ | ||
var Logger = bunyan.createLogger({ | ||
@@ -30,3 +50,10 @@ name: 'full-log', | ||
/** | ||
* If needed, a plugin can create a specific log | ||
* | ||
* | ||
* @param the name of the Logger | ||
* @param the json config structure (see bunyan documemntion ) | ||
* @return the new logger | ||
*/ | ||
var createLogger = function(name, streamInfo) { | ||
@@ -33,0 +60,0 @@ return bunyan.createLogger({ |
{ | ||
"name": "crawler-ninja-logger", | ||
"version": "1.0.0", | ||
"version": "1.0.2", | ||
"description": "Common log method for all crawler.ninja plugins", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
1835
58