forked from EasyTier/EasytierGame
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathapp.vue
More file actions
36 lines (35 loc) · 962 Bytes
/
app.vue
File metadata and controls
36 lines (35 loc) · 962 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
<template>
<NuxtLayout>
<NuxtPage />
</NuxtLayout>
</template>
<script setup lang="ts">
import useMainStore from "@/stores/index";
import { initTheme } from "@/composables/theme";
import { warn, debug, trace, info, error } from "@tauri-apps/plugin-log";
function forwardConsole(fnName: "log" | "debug" | "info" | "warn" | "error", logger: (message: string) => Promise<void>) {
const original = console[fnName];
console[fnName] = message => {
original(message);
try {
if (typeof message === "string") {
logger(message);
} else {
logger(JSON.stringify(message));
}
} catch (e) {
logger(`${message}`);
}
};
}
if (import.meta.env.PROD) {
forwardConsole("log", info);
forwardConsole("debug", debug);
forwardConsole("info", info);
forwardConsole("warn", warn);
forwardConsole("error", error);
}
const mainStore = useMainStore();
// console.log(mainStore.theme)
initTheme(mainStore.theme);
</script>