@homebridge-wyze-node24/homebridge-wyze-node24 1.1.1 → 1.1.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/src/security.js +13 -6
package/package.json
CHANGED
package/src/security.js
CHANGED
|
@@ -111,17 +111,24 @@ function sanitizeDeviceName(name) {
|
|
|
111
111
|
}
|
|
112
112
|
|
|
113
113
|
function wrapLogger(log) {
|
|
114
|
-
const
|
|
114
|
+
const callLevel = (level, args) => {
|
|
115
|
+
const sanitizedArgs = args.map(sanitizeLogMessage)
|
|
115
116
|
|
|
116
|
-
|
|
117
|
+
if (log && typeof log[level] === 'function') {
|
|
118
|
+
return log[level](...sanitizedArgs)
|
|
119
|
+
}
|
|
117
120
|
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
if (typeof underlying === 'function') {
|
|
121
|
-
wrapped[level] = (...args) => underlying(...args.map(sanitizeLogMessage))
|
|
121
|
+
if (typeof log === 'function') {
|
|
122
|
+
return log(...sanitizedArgs)
|
|
122
123
|
}
|
|
123
124
|
}
|
|
124
125
|
|
|
126
|
+
const wrapped = (...args) => callLevel('info', args)
|
|
127
|
+
|
|
128
|
+
for (const level of ['error', 'warn', 'info', 'debug']) {
|
|
129
|
+
wrapped[level] = (...args) => callLevel(level, args)
|
|
130
|
+
}
|
|
131
|
+
|
|
125
132
|
return wrapped
|
|
126
133
|
}
|
|
127
134
|
|