@steambrew/client
Version:
A support library for creating plugins with Millennium.
49 lines (48 loc) • 1.98 kB
JavaScript
const bgStyle1 = 'background:rgb(37, 105, 184); color: white;';
export const log = (moduleName, name, ...args) => {
console.log(`%c ${moduleName} %c ${name} %c`, bgStyle1, 'background:rgb(28, 135, 206); color: white;', 'background: transparent;', ...args);
};
export const group = (moduleName, name, ...args) => {
console.group(`%c ${moduleName} %c ${name} %c`, bgStyle1, 'background: rgb(28, 135, 206); color: white;', 'background: transparent;', ...args);
};
export const groupEnd = (moduleName, name, ...args) => {
console.groupEnd();
if (args?.length > 0)
console.log(`^ %c ${moduleName} %c ${name} %c`, bgStyle1, 'background: rgb(28, 135, 206); color: white;', 'background: transparent;', ...args);
};
export const debug = (moduleName, name, ...args) => {
console.debug(`%c ${moduleName} %c ${name} %c`, bgStyle1, 'background: #1abc9c; color: white;', 'color: blue;', ...args);
};
export const warn = (moduleName, name, ...args) => {
console.warn(`%c ${moduleName} %c ${name} %c`, bgStyle1, 'background: #ffbb00; color: white;', 'color: blue;', ...args);
};
export const error = (moduleName, name, ...args) => {
console.error(`%c ${moduleName} %c ${name} %c`, bgStyle1, 'background: #FF0000;', 'background: transparent;', ...args);
};
class Logger {
constructor(name, moduleName = 'Millennium') {
this.name = name;
this.moduleName = moduleName;
this.name = name;
this.moduleName = moduleName;
}
log(...args) {
log(this.moduleName, this.name, ...args);
}
debug(...args) {
debug(this.moduleName, this.name, ...args);
}
warn(...args) {
warn(this.moduleName, this.name, ...args);
}
error(...args) {
error(this.moduleName, this.name, ...args);
}
group(...args) {
group(this.moduleName, this.name, ...args);
}
groupEnd(...args) {
groupEnd(this.moduleName, this.name, ...args);
}
}
export default Logger;