Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
Object.defineProperty(opts, 'id', {
get() {
if (!id) {
return this.name + (opts.unique ? `-${uuid()}` : '');
}
return id;
},
});
if (opts.timestamp) {
opts.prefix.template = `{{time}} ${opts.prefix.template}`;
}
const log = loglevel.getLogger(opts);
if (!Object.prototype.hasOwnProperty.call(log, 'id')) {
Object.defineProperty(log, 'id', {
get() {
return opts.id;
},
});
}
return log;
}
Object.defineProperty(opts, 'id', {
get() {
if (!id) {
return this.name + (opts.unique ? `-${uuid()}` : '');
}
return id;
},
});
if (opts.timestamp) {
opts.prefix.template = `[{{time}}] ${opts.prefix.template}`;
}
const log = loglevel.getLogger(opts);
if (!Object.prototype.hasOwnProperty.call(log, 'id')) {
Object.defineProperty(log, 'id', {
get() {
return opts.id;
},
});
}
return log;
}