backend-manager 3.0.32 → 3.0.34
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
CHANGED
|
@@ -211,7 +211,7 @@ BackendAssistant.prototype.log = function () {
|
|
|
211
211
|
BackendAssistant.prototype.error = function () {
|
|
212
212
|
const self = this;
|
|
213
213
|
|
|
214
|
-
|
|
214
|
+
const args = Array.prototype.slice.call(arguments);
|
|
215
215
|
|
|
216
216
|
args.unshift('error');
|
|
217
217
|
self.log.apply(self, args);
|
|
@@ -220,17 +220,63 @@ BackendAssistant.prototype.error = function () {
|
|
|
220
220
|
BackendAssistant.prototype.warn = function () {
|
|
221
221
|
const self = this;
|
|
222
222
|
|
|
223
|
-
|
|
223
|
+
const args = Array.prototype.slice.call(arguments);
|
|
224
224
|
|
|
225
225
|
args.unshift('warn');
|
|
226
226
|
self.log.apply(self, args);
|
|
227
227
|
};
|
|
228
228
|
|
|
229
|
+
BackendAssistant.prototype.info = function () {
|
|
230
|
+
const self = this;
|
|
231
|
+
|
|
232
|
+
const args = Array.prototype.slice.call(arguments);
|
|
233
|
+
|
|
234
|
+
args.unshift('info');
|
|
235
|
+
self.log.apply(self, args);
|
|
236
|
+
};
|
|
237
|
+
|
|
238
|
+
BackendAssistant.prototype.debug = function () {
|
|
239
|
+
const self = this;
|
|
240
|
+
|
|
241
|
+
const args = Array.prototype.slice.call(arguments);
|
|
242
|
+
|
|
243
|
+
args.unshift('debug');
|
|
244
|
+
self.log.apply(self, args);
|
|
245
|
+
};
|
|
246
|
+
|
|
247
|
+
BackendAssistant.prototype.notice = function () {
|
|
248
|
+
const self = this;
|
|
249
|
+
|
|
250
|
+
const args = Array.prototype.slice.call(arguments);
|
|
251
|
+
|
|
252
|
+
args.unshift('notice');
|
|
253
|
+
self.log.apply(self, args);
|
|
254
|
+
};
|
|
255
|
+
|
|
256
|
+
BackendAssistant.prototype.critical = function () {
|
|
257
|
+
const self = this;
|
|
258
|
+
|
|
259
|
+
const args = Array.prototype.slice.call(arguments);
|
|
260
|
+
|
|
261
|
+
args.unshift('critical');
|
|
262
|
+
self.log.apply(self, args);
|
|
263
|
+
};
|
|
264
|
+
|
|
265
|
+
BackendAssistant.prototype.emergency = function () {
|
|
266
|
+
const self = this;
|
|
267
|
+
|
|
268
|
+
const args = Array.prototype.slice.call(arguments);
|
|
269
|
+
|
|
270
|
+
args.unshift('emergency');
|
|
271
|
+
self.log.apply(self, args);
|
|
272
|
+
};
|
|
273
|
+
|
|
229
274
|
BackendAssistant.prototype._log = function() {
|
|
230
275
|
const self = this;
|
|
231
276
|
|
|
232
277
|
// 1. Convert args to a normal array
|
|
233
|
-
|
|
278
|
+
const isDevelopment = self.meta.environment === 'development';
|
|
279
|
+
const logs = [...Array.prototype.slice.call(arguments)];
|
|
234
280
|
|
|
235
281
|
// 2. Prepend log prefix log string
|
|
236
282
|
logs.unshift(`[${self.meta.name}/${self.id} @ ${new Date().toISOString()}]:`);
|
|
@@ -242,6 +288,42 @@ BackendAssistant.prototype._log = function() {
|
|
|
242
288
|
} else if (logs[1] === 'warn') {
|
|
243
289
|
logs.splice(1,1)
|
|
244
290
|
console.warn.apply(console, logs);
|
|
291
|
+
} else if (logs[1] === 'info') {
|
|
292
|
+
logs.splice(1,1)
|
|
293
|
+
console.info.apply(console, logs);
|
|
294
|
+
} else if (logs[1] === 'debug') {
|
|
295
|
+
logs.splice(1,1)
|
|
296
|
+
console.debug.apply(console, logs);
|
|
297
|
+
} else if (logs[1] === 'notice') {
|
|
298
|
+
logs.splice(1,1)
|
|
299
|
+
if (isDevelopment) {
|
|
300
|
+
console.log.apply(console, logs);
|
|
301
|
+
} else {
|
|
302
|
+
self.ref.functions.logger.write({
|
|
303
|
+
severity: 'NOTICE',
|
|
304
|
+
message: logs,
|
|
305
|
+
});
|
|
306
|
+
}
|
|
307
|
+
} else if (logs[1] === 'critical') {
|
|
308
|
+
logs.splice(1,1)
|
|
309
|
+
if (isDevelopment) {
|
|
310
|
+
console.log.apply(console, logs);
|
|
311
|
+
} else {
|
|
312
|
+
self.ref.functions.logger.write({
|
|
313
|
+
severity: 'CRITICAL',
|
|
314
|
+
message: logs,
|
|
315
|
+
});
|
|
316
|
+
}
|
|
317
|
+
} else if (logs[1] === 'emergency') {
|
|
318
|
+
logs.splice(1,1)
|
|
319
|
+
if (isDevelopment) {
|
|
320
|
+
console.log.apply(console, logs);
|
|
321
|
+
} else {
|
|
322
|
+
self.ref.functions.logger.write({
|
|
323
|
+
severity: 'EMERGENCY',
|
|
324
|
+
message: logs,
|
|
325
|
+
});
|
|
326
|
+
}
|
|
245
327
|
} else if (logs[1] === 'log') {
|
|
246
328
|
logs.splice(1,1)
|
|
247
329
|
console.log.apply(console, logs);
|