🏗️ enhance logging functionality and add SCSS support in configuration
This commit is contained in:
parent
9946b50d5d
commit
b5fd0c6747
@ -11,13 +11,16 @@ class BeanFactory {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
const instance = new (clazz as any)();
|
const instance = new (clazz as any)();
|
||||||
|
|
||||||
this._beans.set(beanName, instance);
|
this._beans.set(beanName, instance);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static setBean<T>(name: string, bean: T): void {
|
public static setBean<T>(name: string, bean: T): void {
|
||||||
this._beans.set(name, bean);
|
this._beans.set(name, bean);
|
||||||
Logger.info(`register bean ${name} ${bean}`);
|
Logger.info(
|
||||||
|
`${this.name}.${arguments[0]}`,
|
||||||
|
`register bean ${name} ${bean}`
|
||||||
|
);
|
||||||
|
// Logger.info(`register bean ${name} ${bean}`);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static getBean<T>(name: string): T {
|
public static getBean<T>(name: string): T {
|
||||||
|
@ -6,13 +6,21 @@ class Logger {
|
|||||||
log.transports.console.level = "debug";
|
log.transports.console.level = "debug";
|
||||||
}
|
}
|
||||||
|
|
||||||
static info(msg: string) {}
|
public static info(module: string, msg: string) {
|
||||||
|
log.info(`[${module}] ${msg}`);
|
||||||
|
}
|
||||||
|
|
||||||
static debug(msg: string) {}
|
public static debug(module: string, msg: string) {
|
||||||
|
log.debug(`[${module}] ${msg}`);
|
||||||
|
}
|
||||||
|
|
||||||
static warn(msg: string) {}
|
public static warn(module: string, msg: string) {
|
||||||
|
log.warn(`[${module}] ${msg}`);
|
||||||
|
}
|
||||||
|
|
||||||
static error(msg: string) {}
|
public static error(module: string, msg: string) {
|
||||||
|
log.warn(`[${module}] ${msg}`);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
export default Logger;
|
export default Logger;
|
8
electron/core/annotation/Logger.ts
Normal file
8
electron/core/annotation/Logger.ts
Normal file
@ -0,0 +1,8 @@
|
|||||||
|
// export default function Logger(module?: string): ClassDecorator {
|
||||||
|
// return function (target: Object) {
|
||||||
|
// Object.defineProperty(target, "logger", {
|
||||||
|
// value: new (require("../LoggerFactory").default)(module),
|
||||||
|
// writable: true
|
||||||
|
// });
|
||||||
|
// };
|
||||||
|
// }
|
@ -115,6 +115,10 @@ class FrpcDesktopApp {
|
|||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
});
|
});
|
||||||
|
Logger.info(
|
||||||
|
`FrpcDesktopApp.initializeWindow`,
|
||||||
|
`Window initialized.`
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
initializeTray() {
|
initializeTray() {
|
||||||
@ -149,6 +153,10 @@ class FrpcDesktopApp {
|
|||||||
tray.on("double-click", () => {
|
tray.on("double-click", () => {
|
||||||
this._win.show();
|
this._win.show();
|
||||||
});
|
});
|
||||||
|
Logger.info(
|
||||||
|
`FrpcDesktopApp.initializeTray`,
|
||||||
|
`Tray initialized.`
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
initializeElectronApp() {
|
initializeElectronApp() {
|
||||||
@ -262,6 +270,11 @@ class FrpcDesktopApp {
|
|||||||
// todo stop frpc process
|
// todo stop frpc process
|
||||||
this._quitting = true;
|
this._quitting = true;
|
||||||
});
|
});
|
||||||
|
|
||||||
|
Logger.info(
|
||||||
|
`FrpcDesktopApp.initializeElectronApp`,
|
||||||
|
`ElectronApp initialized.`
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
initializeBeans() {
|
initializeBeans() {
|
||||||
@ -334,6 +347,10 @@ class FrpcDesktopApp {
|
|||||||
"systemController",
|
"systemController",
|
||||||
new SystemController(BeanFactory.getBean("systemService"))
|
new SystemController(BeanFactory.getBean("systemService"))
|
||||||
);
|
);
|
||||||
|
Logger.info(
|
||||||
|
`FrpcDesktopApp.initializeBeans`,
|
||||||
|
`Beans initialized.`
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -353,7 +370,10 @@ class FrpcDesktopApp {
|
|||||||
};
|
};
|
||||||
bean[method].call(bean, listenerParam);
|
bean[method].call(bean, listenerParam);
|
||||||
});
|
});
|
||||||
Logger.info("initialize listeners success");
|
Logger.info(
|
||||||
|
`FrpcDesktopApp.initializeListeners`,
|
||||||
|
`Listeners initialized.`
|
||||||
|
);
|
||||||
// this._beans.get("logService").watchFrpcLog(this._win);
|
// this._beans.get("logService").watchFrpcLog(this._win);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -377,9 +397,21 @@ class FrpcDesktopApp {
|
|||||||
const [beanName, method] = router.controller.split(".");
|
const [beanName, method] = router.controller.split(".");
|
||||||
const bean = BeanFactory.getBean(beanName);
|
const bean = BeanFactory.getBean(beanName);
|
||||||
bean[method].call(bean, req);
|
bean[method].call(bean, req);
|
||||||
|
Logger.debug(
|
||||||
|
`ipcRouter`,
|
||||||
|
`path: ${router.path} + req: (channel: ${
|
||||||
|
req.channel
|
||||||
|
}, args: ${JSON.stringify(
|
||||||
|
req.args
|
||||||
|
)}) => bean: ${beanName}.${method}`
|
||||||
|
);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
Logger.info(
|
||||||
|
`FrpcDesktopApp.initializeRouters`,
|
||||||
|
`Routers initialized.`
|
||||||
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -23,6 +23,13 @@ export default defineConfig(({ command }) => {
|
|||||||
const sourcemap = isServe || !!process.env.VSCODE_DEBUG;
|
const sourcemap = isServe || !!process.env.VSCODE_DEBUG;
|
||||||
|
|
||||||
return {
|
return {
|
||||||
|
css: {
|
||||||
|
preprocessorOptions: {
|
||||||
|
scss: {
|
||||||
|
api: "modern-compiler"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
plugins: [
|
plugins: [
|
||||||
vue(),
|
vue(),
|
||||||
electron([
|
electron([
|
||||||
|
Loading…
Reference in New Issue
Block a user