Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

comb

Package Overview
Dependencies
Maintainers
1
Versions
46
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

comb - npm Package Compare versions

Comparing version 0.3.5 to 0.3.6

11

docs-md/logging.md

@@ -86,2 +86,13 @@ ##Logging.

#### `.timer()`
The comb logger also has a `timer()` method that will append a duration to the end of your log message
```
var timer = LOGGER.timer();
setTimeout(function(){
timer.info("HELLO TIMERS!!!"); //HELLO TIMERS!!! [Duration: 5000ms]
}, 5000);
```
####Appenders

@@ -88,0 +99,0 @@

4

History.md

@@ -0,1 +1,5 @@

# 0.3.6
* Added new `timer` function to comb.logger.
# 0.3.5

@@ -2,0 +6,0 @@

@@ -15,2 +15,3 @@ var os = require("os"),

configurators = require("./config");
var rootTree;

@@ -321,2 +322,46 @@ var LoggerTree = define.define(null, {

/**
* Create a timer that can be used to log statements with a duration at the send.
*
* ```
* var timer = LOGGER.timer();
* setTimeout(function(){
* timer.info("HELLO TIMERS!!!"); //HELLO TIMERS!!! [Duration: 5000ms]
* }, 5000);
* ```
*
* @param timerFormat
* @returns {{info: Function, debug: Function, error: Function, warn: Function, trace: Function, fatal: Function, end: Function}}
*/
timer: function (timerFormat) {
timerFormat = timerFormat || " [Duration: %dms]";
function timerLog(level, start) {
return function (message) {
var args = argsToArray(arguments, 1);
message += timerFormat;
args.push(new Date() - start);
self.log.apply(self, [level, message].concat(args));
return ret;
};
}
var start = new Date(),
self = this,
ret = {
info: timerLog(Level.INFO, start),
debug: timerLog(Level.DEBUG, start),
error: timerLog(Level.ERROR, start),
warn: timerLog(Level.WARN, start),
trace: timerLog(Level.TRACE, start),
fatal: timerLog(Level.FATAL, start),
log: function (level) {
return timerLog(level, start).apply(this, argsToArray(arguments, 1));
},
end: function () {
start = self = null;
}
};
return ret;
},
/**
* Creates a log event to be passed to appenders

@@ -323,0 +368,0 @@ *

2

package.json
{
"name": "comb",
"description": "A framework for node",
"version": "0.3.5",
"version": "0.3.6",
"keywords": ["OO", "Object Oriented", "Collections", "Tree", "HashTable", "Pool", "Logging", "Promise", "Promises", "Proxy"],

@@ -6,0 +6,0 @@ "repository": {

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc