forked from jsnbuchanan/crowd-funder-for-time-pwa
feat(logging): enhance debug logging across app
Improves application logging and error tracking: - Add structured logging in main.common.ts for app initialization - Enhance API error handling with detailed context in services - Add deep link debugging in Capacitor platform - Improve plan service logging with retry information - Update endorser server logs for better cache debugging Technical changes: - Replace console.error with info for non-critical cache misses - Add component context to global error handler - Add detailed logging for plan loading and retries - Improve deep link route matching logs - Add mount state logging for Capacitor This improves debugging capabilities across web and mobile platforms.
This commit is contained in:
@@ -11,12 +11,17 @@ import Camera from "simple-vue-camera";
|
||||
|
||||
// Global Error Handler
|
||||
function setupGlobalErrorHandler(app: VueApp) {
|
||||
console.log("[App Init] Setting up global error handler");
|
||||
app.config.errorHandler = (
|
||||
err: unknown,
|
||||
instance: ComponentPublicInstance | null,
|
||||
info: string
|
||||
) => {
|
||||
console.error("Ouch! Global Error Handler.", err, info, instance);
|
||||
console.error("[App Error] Global Error Handler:", {
|
||||
error: err,
|
||||
info,
|
||||
component: instance?.$options.name || 'unknown'
|
||||
});
|
||||
alert(
|
||||
(err instanceof Error ? err.message : "Something bad happened") +
|
||||
" - Try reloading or restarting the app."
|
||||
@@ -26,15 +31,31 @@ function setupGlobalErrorHandler(app: VueApp) {
|
||||
|
||||
// Function to initialize the app
|
||||
export function initializeApp() {
|
||||
const app = createApp(App)
|
||||
.component("fa", FontAwesomeIcon)
|
||||
.component("camera", Camera)
|
||||
.use(createPinia())
|
||||
.use(VueAxios, axios)
|
||||
.use(router)
|
||||
.use(Notifications);
|
||||
console.log("[App Init] Starting app initialization");
|
||||
console.log("[App Init] Platform:", process.env.VITE_PLATFORM);
|
||||
|
||||
const app = createApp(App);
|
||||
console.log("[App Init] Vue app created");
|
||||
|
||||
app.component("fa", FontAwesomeIcon)
|
||||
.component("camera", Camera);
|
||||
console.log("[App Init] Components registered");
|
||||
|
||||
const pinia = createPinia();
|
||||
app.use(pinia);
|
||||
console.log("[App Init] Pinia store initialized");
|
||||
|
||||
app.use(VueAxios, axios);
|
||||
console.log("[App Init] Axios initialized");
|
||||
|
||||
app.use(router);
|
||||
console.log("[App Init] Router initialized");
|
||||
|
||||
app.use(Notifications);
|
||||
console.log("[App Init] Notifications initialized");
|
||||
|
||||
setupGlobalErrorHandler(app);
|
||||
console.log("[App Init] App initialization complete");
|
||||
|
||||
return app;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user