UNPKG

homebridge-wideq

Version:
39 lines (38 loc) 1.27 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); var LogUtil = /** @class */ (function () { function LogUtil(flag, log) { this.flag = flag; this.log = log; } LogUtil.prototype.debug = function (str) { this.log.debug(this.flag ? '[' + this.flag + '] ' : '' + '[DEBUG] ' + str); }; LogUtil.prototype.info = function (str) { this.log.info(this.flag ? '[' + this.flag + '] ' : '' + '[INFO] ' + str); }; LogUtil.prototype.warn = function (str) { this.log.warn(this.flag ? '[' + this.flag + '] ' : '' + '[WARN] ' + str); }; LogUtil.prototype.error = function (str) { this.log.error(this.flag ? '[' + this.flag + '] ' : '' + '[ERROR] ' + str); if (str instanceof Error) { this.log.debug(this.flag ? '[' + this.flag + '] ' : '' + '[ERROR] ' + str.stack); } }; LogUtil.prototype.objKey2Str = function (obj) { var keys = ''; try { for (var key in obj) { keys += key + ', '; } keys = keys.substring(0, keys.lastIndexOf(',')); } catch (e) { return e; } return keys; }; return LogUtil; }()); exports.default = LogUtil;