@voliware/logger
Advanced tools
Comparing version 2.0.3 to 2.0.4
{ | ||
"name": "@voliware/logger", | ||
"version": "2.0.3", | ||
"version": "2.0.4", | ||
"description": "A tiny Javascript logger with levels and several options. Supports Node, MongoDB, and all modern Browsers", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
@@ -35,3 +35,3 @@ const Logger = require('./logger'); | ||
this.collection = collection; | ||
this.log_count = this.collection.countDocuments(); | ||
this.log_count = 0; | ||
this.console_logger = new Logger(name, {level, enabled: console, context, maxlogs, timestamp}); | ||
@@ -48,2 +48,13 @@ } | ||
/** | ||
* Insert a message into the collection | ||
* @param {LoggerMessage} message | ||
*/ | ||
insertMessage(message){ | ||
if(!this.log_count){ | ||
this.log_count = this.collection.countDocuments(); | ||
} | ||
this.collection.insertOne(message); | ||
} | ||
/** | ||
* The output function to log a verbose message. | ||
@@ -55,3 +66,3 @@ * @param {LoggerMessage|Object} message | ||
this.console_logger.enabled && this.console_logger._verbose(message); | ||
return this.collection.insertOne(message); | ||
return this.insertMessage(message); | ||
} | ||
@@ -66,3 +77,3 @@ | ||
this.console_logger.enabled && this.console_logger._debug(message); | ||
return this.collection.insertOne(message); | ||
return this.insertMessage(message); | ||
} | ||
@@ -77,3 +88,3 @@ | ||
this.console_logger.enabled && this.console_logger._info(message); | ||
return this.collection.insertOne(message); | ||
return this.insertMessage(message); | ||
} | ||
@@ -88,3 +99,3 @@ | ||
this.console_logger.enabled && this.console_logger._warning(message); | ||
return this.collection.insertOne(message); | ||
return this.insertMessage(message); | ||
} | ||
@@ -99,9 +110,16 @@ | ||
this.console_logger.enabled && this.console_logger._error(message); | ||
return this.collection.insertOne(message); | ||
return this.insertMessage(message); | ||
} | ||
/** | ||
* Create a new collection | ||
*/ | ||
createNewCollection(){ | ||
// return this.db.createCollection(name) | ||
} | ||
/** | ||
* Delete the first document | ||
* @returns {Promise} | ||
*/ | ||
deleteFirstDocument(){ | ||
@@ -108,0 +126,0 @@ return this.collection.deleteOne({}); |
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
40598
965