diff --git a/src/App.vue b/src/App.vue index 4d7be20c..8f8cb4fc 100644 --- a/src/App.vue +++ b/src/App.vue @@ -345,7 +345,6 @@ interface Settings { }) export default class App extends Vue { $notify!: (notification: NotificationIface, timeout?: number) => void; - $logAndConsole!: (message: string, isError?: boolean) => Promise; stopAsking = false; diff --git a/src/utils/PlatformServiceMixin.ts b/src/utils/PlatformServiceMixin.ts index cb400209..543314d3 100644 --- a/src/utils/PlatformServiceMixin.ts +++ b/src/utils/PlatformServiceMixin.ts @@ -1062,6 +1062,39 @@ export const PlatformServiceMixin = { return false; } }, + + // ================================================= + // LOGGING METHODS (convenience methods for components) + // ================================================= + + /** + * Log message to database - $log() + * @param message Message to log + * @param level Log level (info, warn, error) + * @returns Promise + */ + async $log(message: string, level?: string): Promise { + return logger.toDb(message, level); + }, + + /** + * Log error message to database - $logError() + * @param message Error message to log + * @returns Promise + */ + async $logError(message: string): Promise { + return logger.toDb(message, "error"); + }, + + /** + * Log message to console and database - $logAndConsole() + * @param message Message to log + * @param isError Whether this is an error message + * @returns Promise + */ + async $logAndConsole(message: string, isError = false): Promise { + return logger.toConsoleAndDb(message, isError); + }, }, }; @@ -1123,6 +1156,11 @@ export interface IPlatformServiceMixin { did: string, settings: Partial, ): Promise; + + // Logging methods + $log(message: string, level?: string): Promise; + $logError(message: string): Promise; + $logAndConsole(message: string, isError?: boolean): Promise; } // TypeScript declaration merging to eliminate (this as any) type assertions @@ -1217,5 +1255,10 @@ declare module "@vue/runtime-core" { did: string, settings: Partial, ): Promise; + + // Logging methods + $log(message: string, level?: string): Promise; + $logError(message: string): Promise; + $logAndConsole(message: string, isError?: boolean): Promise; } } diff --git a/src/views/ClaimView.vue b/src/views/ClaimView.vue index 2e81e665..b3c56b02 100644 --- a/src/views/ClaimView.vue +++ b/src/views/ClaimView.vue @@ -8,6 +8,7 @@