Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: implement debug logger #569

Merged
merged 8 commits into from
Dec 4, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions packages/extension/.env.example
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
# VITE_DEBUG_LOG="swap:*"
VITE_DEBUG_LOG=
4 changes: 4 additions & 0 deletions packages/extension/src/types/env.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
interface ImportMetaEnv {
VITE_DEBUG_LOG?: string
}

9 changes: 9 additions & 0 deletions packages/extension/src/types/window.d.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,12 @@
interface Window {
[key: string]: any;
__ENKRYPT_DEBUG_LOG_CONF__: undefined | string
}

declare global {
var __ENKRYPT_DEBUG_LOG_CONF__: undefined | string
}

// Required to make the `delare global` exports work for some reason
export { }

5 changes: 5 additions & 0 deletions packages/extension/src/ui/action/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,11 @@ import Vue3Lottie from 'vue3-lottie';

global.WeakMap = WeakMap;

if (import.meta.env.DEV) {
globalThis.__ENKRYPT_DEBUG_LOG_CONF__ = import.meta.env.VITE_DEBUG_LOG
}


const app = createApp(App);

app.use(router).use(Vue3Lottie, { name: 'vue3lottie' });
Expand Down
4 changes: 4 additions & 0 deletions packages/extension/src/ui/onboard/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,10 @@ import * as filters from '@action/utils/filters';

global.WeakMap = WeakMap;

if (import.meta.env.DEV) {
globalThis.__ENKRYPT_DEBUG_LOG_CONF__ = import.meta.env.VITE_DEBUG_LOG
}

const router = createRouter({
history: createWebHashHistory(),
routes,
Expand Down
4 changes: 4 additions & 0 deletions packages/extension/src/ui/provider-pages/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,10 @@ import Vue3Lottie from 'vue3-lottie';

global.WeakMap = WeakMap;

if (import.meta.env.DEV) {
globalThis.__ENKRYPT_DEBUG_LOG_CONF__ = import.meta.env.VITE_DEBUG_LOG
}

const router = createRouter({
history: createWebHashHistory(),
routes,
Expand Down
Loading