Socket
Socket
Sign inDemoInstall

console-stamp

Package Overview
Dependencies
1
Maintainers
1
Versions
35
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 0.1.1 to 0.1.2

test.js

24

main.js

@@ -0,1 +1,2 @@

/*globals module:false, require:false, process:false*/
/**

@@ -14,23 +15,26 @@ *

module.exports = function( con, pattern ) {
module.exports = function ( con, pattern ) {
if( con.__ts__ ){ return; }
"use strict";
if ( con.__ts__ ) {
return;
}
var slice = Array.prototype.slice;
[ 'log', 'debug', 'info', 'warn', 'error' ].forEach( function(f){
[ 'log', 'info', 'warn', 'error', 'dir', 'assert' ].forEach( function ( f ) {
var org = con[f];
var org = con[ f ];
con[f] = function(){
con[f] = function () {
var date = dateFormat( pattern ),
var date = dateFormat( pattern ) + " ",
args = slice.call( arguments );
typeof args[0] === "string" ? args[0] = date + " " + args[0] : args.unshift( date );
process.stdout.write( date );
return org.apply( con, args );
return org.apply(con, args);
};
});
} );

@@ -37,0 +41,0 @@ con.__ts__ = true;

{
"name": "console-stamp",
"main": "main",
"version": "0.1.1",
"version": "0.1.2",
"author": {

@@ -23,4 +23,4 @@ "name": "Ståle Raknes",

"dependencies" : {
"dateformat" : "*"
"dateformat" : "1.0.7-1.2.3"
}
}

@@ -5,4 +5,2 @@ # console-stamp

Inspired by [FGRibreau/node-nice-console][FGRibreau]
## Usage ##

@@ -25,3 +23,45 @@

// -> 16:02:35.325 Server running at port 8080
### Example
console.time( "MyTimer" );
console.log( "LOG" );
console.info( "INFO" );
console.warn( "WARN" );
console.error( "ERROR" );
console.dir( { foo: "bar" } );
console.trace();
console.timeEnd( "MyTimer" );
console.assert( count < 10, "Count is > 10" );
Result:
20:01:27.500 LOG
20:01:27.504 INFO
20:01:27.504 WARN
20:01:27.504 ERROR
20:01:27.504 { bar: 'console.dir' }
20:01:27.508 Trace
at Object.<anonymous> (/Users/starak/code/node-console-stamp/test.js:14:9)
at Module._compile (module.js:456:26)
at Object.Module._extensions..js (module.js:474:10)
at Module.load (module.js:356:32)
at Function.Module._load (module.js:312:12)
at Function.Module.runMain (module.js:497:10)
at startup (node.js:119:16)
at node.js:901:3
20:01:27.510 MyTimer: 10ms
20:01:27.510
AssertionError: Count is > 10
at Console.assert (console.js:102:23)
at Console.con.(anonymous function) [as assert] (/Users/starak/code/node-console-stamp/main.js:35:24)
at Object.<anonymous> (/Users/starak/code/node-console-stamp/test.js:16:9)
at Module._compile (module.js:456:26)
at Object.Module._extensions..js (module.js:474:10)
at Module.load (module.js:356:32)
at Function.Module._load (module.js:312:12)
at Function.Module.runMain (module.js:497:10)
at startup (node.js:119:16)
at node.js:901:3
See more about timestamp patterns at [felixges][felixge] excellent [dateformat][dateformat]

@@ -28,0 +68,0 @@

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

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

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc