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

comb

Package Overview
Dependencies
Maintainers
2
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.4.0 to 0.4.1

5

History.md

@@ -0,1 +1,6 @@

# 0.4.1
* Adding `wrapStyle` option to `ConsoleAppender` to allow stripping of styling. Defaults to true.
* Added `levelNameColored` to `ConsoleAppender`
# 0.4.0

@@ -2,0 +7,0 @@

42

lib/logging/appenders/consoleAppender.js

@@ -10,2 +10,3 @@ var define = require("../../define.js").define, base = require("../../base"), string = base.string, style = string.style, format = string.format, Appender = require("./appender"), Level = require("../level");

*/
Appender.extend({

@@ -17,17 +18,38 @@ instance: {

!options.name && (options.name = "consoleAppender");
this.__wrapStyle = options.wrapStyle;
if (!("wrapStyle" in options)) {
this.__wrapStyle = true;
}
this._super(arguments, [options]);
},
getLevelColor: function (level) {
if (Level.ERROR.equals(level) || Level.FATAL.equals(level)) {
return "red";
} else if (Level.WARN.equals(level)) {
return "yellow";
} else if (Level.DEBUG.equals(level)) {
return "cyan";
} else if (Level.TRACE.equals(level)) {
return "magenta";
} else if (Level.INFO.equals(level)) {
return "blue";
}
return null;
},
extraEventData: function (event) {
var level = event.level,
color = this.getLevelColor(level);
return base.merge({
levelNameColored: color ? style(level.name, color) : level,
}, event);
},
append: function (event) {
if (this._canAppend(event)) {
var message = format(this.__pattern, event);
var level = event.level;
if (Level.ERROR.equals(level) || Level.FATAL.equals(level)) {
console.log(style(message, "red"));
} else if (Level.WARN.equals(level)) {
console.log(style(message, "yellow"));
} else if (Level.DEBUG.equals(level)) {
console.log(style(message, "magenta"));
} else if (Level.TRACE.equals(level)) {
console.log(style(message, "cyan"));
var level = event.level,
message = format(this.__pattern, this.extraEventData(event));
if (this.__wrapStyle) {
console.log(style(message, this.getLevelColor(level)));
} else {

@@ -34,0 +56,0 @@ console.log(message);

{
"name": "comb",
"description": "A framework for node",
"version": "0.4.0",
"version": "0.4.1",
"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

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

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