@node-red/util
Advanced tools
Comparing version 4.0.2 to 4.0.3
@@ -78,8 +78,24 @@ /*! | ||
// Older versions of Node-RED used the deprecated util.log function. | ||
// With Node.js 22, use of that function causes warnings. So here we | ||
// are replicating the same format output to ensure we don't break any | ||
// log parsing that happens in the real world. | ||
const months = ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec']; | ||
const utilLog = function (msg) { | ||
const d = new Date(); | ||
const time = [ | ||
d.getHours().toString().padStart(2, '0'), | ||
d.getMinutes().toString().padStart(2, '0'), | ||
d.getSeconds().toString().padStart(2, '0') | ||
].join(':'); | ||
console.log(`${d.getDate()} ${months[d.getMonth()]} ${time} - ${msg}`) | ||
} | ||
var consoleLogger = function(msg) { | ||
if (msg.level == log.METRIC || msg.level == log.AUDIT) { | ||
util.log("["+levelNames[msg.level]+"] "+JSON.stringify(msg)); | ||
utilLog("["+levelNames[msg.level]+"] "+JSON.stringify(msg)); | ||
} else { | ||
if (verbose && msg.msg && msg.msg.stack) { | ||
util.log("["+levelNames[msg.level]+"] "+(msg.type?"["+msg.type+":"+(msg.name||msg.id)+"] ":"")+msg.msg.stack); | ||
utilLog("["+levelNames[msg.level]+"] "+(msg.type?"["+msg.type+":"+(msg.name||msg.id)+"] ":"")+msg.msg.stack); | ||
} else { | ||
@@ -95,3 +111,3 @@ var message = msg.msg; | ||
util.log("["+levelNames[msg.level]+"] "+(msg.type?"["+msg.type+":"+(msg.name||msg.id)+"] ":"")+message); | ||
utilLog("["+levelNames[msg.level]+"] "+(msg.type?"["+msg.type+":"+(msg.name||msg.id)+"] ":"")+message); | ||
} | ||
@@ -98,0 +114,0 @@ } |
{ | ||
"name": "@node-red/util", | ||
"version": "4.0.2", | ||
"version": "4.0.3", | ||
"license": "Apache-2.0", | ||
@@ -5,0 +5,0 @@ "repository": { |
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
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
77270
1908