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

pixl-logger

Package Overview
Dependencies
Maintainers
1
Versions
24
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

pixl-logger - npm Package Compare versions

Comparing version 1.0.2 to 1.0.3

22

logger.js

@@ -12,2 +12,3 @@ // Generic Logger Class for Node.JS

var glob = require('glob');
var chalk = require('chalk');

@@ -19,2 +20,5 @@ var Class = require("pixl-class");

columnColors: ['gray', 'red', 'green', 'yellow', 'blue', 'magenta', 'cyan'],
dividerColor: 'dim',
__construct: function(path, columns, args) {

@@ -95,3 +99,19 @@ // create new logger instance

// echo to console if desired
if (this.args.echo) process.stdout.write(line);
if (this.args.echo) {
if (this.args.color) {
var ccols = [];
var nclrs = this.columnColors.length;
var dclr = chalk[ this.dividerColor ];
for (var idx = 0, len = cols.length; idx < len; idx++) {
ccols.push( chalk[ this.columnColors[idx % nclrs] ]( cols[idx] ) );
}
process.stdout.write(
dclr('[') + ccols.join( dclr('][') ) + dclr(']') + "\n"
);
} // color
else {
process.stdout.write(line);
}
}
},

@@ -98,0 +118,0 @@

3

package.json
{
"name": "pixl-logger",
"version": "1.0.2",
"version": "1.0.3",
"description": "A simple logging class which generates [bracket][delimited] log columns.",

@@ -24,2 +24,3 @@ "author": "Joseph Huckaby <jhuckaby@gmail.com>",

"glob": "^5.0.0",
"chalk": "^1.1.1",
"pixl-class": ">=1.0.0",

@@ -26,0 +27,0 @@ "pixl-tools": ">=1.0.0"

@@ -141,2 +141,18 @@ # Overview

### Colored Logs
If you set the `color` arg to any true value, the logger will echo all log entries in color (assuming you have a terminal that supports color), using the [chalk](https://www.npmjs.com/package/chalk) module. The color sequence is `gray`, `red`, `green`, `yellow`, `blue`, `magenta` and `cyan`. If your log has more than 7 columns, the colors repeat. The bracket dividers are printed in `dim`. Here is a screenshot:
![Colored Log Example](https://pixlcore.com/software/pixl-logger/colored-log-example.png)
Example:
```javascript
logger.set( 'echo', true );
logger.set( 'color', true );
logger.debug( 1, "This will be colored in the console!" );
```
Note that the color only affects the local echo in your terminal. The log file itself is still written in plain text.
## Last Line Logged

@@ -143,0 +159,0 @@

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