@voliware/logger
Advanced tools
Comparing version 2.0.2 to 2.0.3
{ | ||
"name": "@voliware/logger", | ||
"version": "2.0.2", | ||
"version": "2.0.3", | ||
"description": "A tiny Javascript logger with levels and several options. Supports Node, MongoDB, and all modern Browsers", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
@@ -25,2 +25,3 @@ const EOL = require('os').EOL; | ||
* @param {Boolean} [options.multiplefiles=false] - Whether to start a new file on maxsize or maxlogs | ||
* @param {Boolean} [options.console=true] - Whether to also log to the console | ||
*/ | ||
@@ -35,3 +36,4 @@ constructor(name, { | ||
maxsize = 0, | ||
multiplefiles = false | ||
multiplefiles = false, | ||
console = true | ||
}={}) | ||
@@ -42,2 +44,3 @@ { | ||
this.multiplefiles = multiplefiles; | ||
this.console_logger = new Logger(name, {level, enabled: console, context, maxlogs, timestamp}); | ||
@@ -204,2 +207,3 @@ // todo | ||
async _verbose(message){ | ||
this.console_logger.enabled && this.console_logger._verbose(message); | ||
await this.append(message.toString()); | ||
@@ -214,2 +218,3 @@ } | ||
async _debug(message){ | ||
this.console_logger.enabled && this.console_logger._debug(message); | ||
await this.append(message.toString()); | ||
@@ -224,2 +229,3 @@ } | ||
async _info(message){ | ||
this.console_logger.enabled && this.console_logger._info(message); | ||
await this.append(message.toString()); | ||
@@ -234,2 +240,3 @@ } | ||
async _warning(message){ | ||
this.console_logger.enabled && this.console_logger._warning(message); | ||
await this.append(message.toString()); | ||
@@ -243,2 +250,3 @@ } | ||
async _error(message){ | ||
this.console_logger.enabled && this.console_logger._error(message); | ||
await this.append(message.toString()); | ||
@@ -245,0 +253,0 @@ } |
@@ -21,2 +21,3 @@ const Logger = require('./logger'); | ||
* @param {Collection} options.collection - MongoDB collection reference | ||
* @param {Boolean} [options.console=true] - Whether to also log to the console | ||
*/ | ||
@@ -29,3 +30,4 @@ constructor(name, { | ||
maxlogs = 0, | ||
collection = null | ||
collection = null, | ||
console = true | ||
}={}) | ||
@@ -36,2 +38,3 @@ { | ||
this.log_count = this.collection.countDocuments(); | ||
this.console_logger = new Logger(name, {level, enabled: console, context, maxlogs, timestamp}); | ||
} | ||
@@ -52,2 +55,3 @@ | ||
_verbose(message){ | ||
this.console_logger.enabled && this.console_logger._verbose(message); | ||
return this.collection.insertOne(message); | ||
@@ -62,2 +66,3 @@ } | ||
_debug(message){ | ||
this.console_logger.enabled && this.console_logger._debug(message); | ||
return this.collection.insertOne(message); | ||
@@ -72,2 +77,3 @@ } | ||
_info(message){ | ||
this.console_logger.enabled && this.console_logger._info(message); | ||
return this.collection.insertOne(message); | ||
@@ -82,2 +88,3 @@ } | ||
_warning(message){ | ||
this.console_logger.enabled && this.console_logger._warning(message); | ||
return this.collection.insertOne(message); | ||
@@ -92,2 +99,3 @@ } | ||
_error(message){ | ||
this.console_logger.enabled && this.console_logger._error(message); | ||
return this.collection.insertOne(message); | ||
@@ -94,0 +102,0 @@ } |
@@ -14,3 +14,7 @@ const Assert = require('assert'); | ||
catch(e){} | ||
this.filelogger = new Logger.FileLogger("App", {filepath: this.testfile, timestamp: false}); | ||
this.filelogger = new Logger.FileLogger("App", { | ||
filepath: this.testfile, | ||
console: false, | ||
timestamp: false | ||
}); | ||
@@ -30,3 +34,4 @@ // Mongo DB Logger | ||
this.mongologger = new Logger.MongoDbLogger("App", { | ||
collection: this.collection, | ||
collection: this.collection, | ||
console: false, | ||
timestamp: false | ||
@@ -33,0 +38,0 @@ }); |
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
40196
947