Socket
Socket
Sign inDemoInstall

console-stamp

Package Overview
Dependencies
60
Maintainers
1
Versions
35
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 0.2.3 to 0.2.4

stderr.log

16

main.js

@@ -30,9 +30,8 @@ /*jshint node:true, bitwise:false */

for ( var logFunction in levelPriorities ) {
if ( !levelPriorities.hasOwnProperty( logFunction ) ) {
continue;
if ( levelPriorities.hasOwnProperty( logFunction ) ) {
if ( levelPriority >= levelPriorities[logFunction] ) {
logFunctions.push( logFunction );
}
}
if ( levelPriority >= levelPriorities[logFunction] ) {
logFunctions.push( logFunction );
}
}

@@ -62,2 +61,5 @@

var stdout = options.stdout;
var stderr = options.stderr || options.stdout;
var dateFormat = options.formatter || defaultDateFormat,

@@ -147,5 +149,5 @@ allowedLogFunctions = getAllowedLogFunctions( options.level );

if ( f === "error" || f === "warn" || ( f === "assert" && !args[0] ) ) {
process.stderr.write( prefix );
( stderr || process.stderr ).write( prefix );
} else if ( f !== "assert" ) {
process.stdout.write( prefix );
( stdout || process.stdout ).write( prefix );
}

@@ -152,0 +154,0 @@

{
"name": "console-stamp",
"main": "main",
"version": "0.2.3",
"version": "0.2.4",
"author": {

@@ -6,0 +6,0 @@ "name": "Ståle Raknes",

@@ -24,3 +24,3 @@ # console-stamp

#### console
The console itself.
The global console or [custom console](#customconsole).

@@ -47,2 +47,6 @@ #### options {Object|String}

* **options.stdout** {WritableStream}<br>A custom `stdout` to use with [custom console](#customconsole).<br>**Default:** `process.stdout`
* **options.stderr** {WritableStream}<br>A custom `stderr` to use with [custom console](#customconsole).<br>**Default:** `options.stdout` or `process.stdout`
* **options.colors** {Object}<br>An object representing a color theme. More info [here](https://www.npmjs.com/package/chalk).

@@ -125,2 +129,25 @@

<a name="customconsole"></a>
### Custom Console [v0.2.4+]
As of version 0.2.4 you can also create a custom console with its own `stdout` and `stderr` like this:
```
var fs = require( 'fs' );
var output = fs.createWriteStream( './stdout.log' );
var errorOutput = fs.createWriteStream( './stderr.log' );
var logger = new console.Console( output, errorOutput );
console_stamp( logger, {
stdout: output,
stderr: errorOutput
} );
```
Everything is then written to the files.
**NOTE:** If `stderr` isn't passed, warning and error output will be sent to the given `stdout`.
### Custom Formatter Example

@@ -127,0 +154,0 @@

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

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

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc