🔊 调试模式下的log不输出到文件

This commit is contained in:
目棃
2024-03-01 13:37:56 +08:00
parent 16b3a9d1a7
commit ac44f19d35
3 changed files with 22 additions and 6 deletions

View File

@@ -1,16 +1,24 @@
/**
* @file utils/TGLogger.ts
* @description 日志工具
* @since Beta v0.4.2
* @since Beta v0.4.4
*/
import { info, warn, error } from "tauri-plugin-log-api";
import { info, warn, error, attachConsole } from "tauri-plugin-log-api";
/**
* @description 日志工具
* @since Beta v0.4.2
* @since Beta v0.4.4
*/
class TGLogger {
constructor() {
if (import.meta.env.MODE === "development") {
void attachConsole().then(() => {
console.log("Console attached");
});
}
}
/**
* @description 输出日志-信息
* @since Beta v0.4.2