Comparing version 0.4.0 to 0.4.1
@@ -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 @@ |
@@ -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
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
New author
Supply chain riskA new npm collaborator published a version of the package for the first time. New collaborators are usually benign additions to a project, but do indicate a change to the security surface area of a package.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
12090
2917677
80
1