From 6e75d64c05b152c4add10d7391120b38d8cc1db6 Mon Sep 17 00:00:00 2001 From: Beef Date: Sun, 19 Feb 2023 22:29:25 +0000 Subject: [PATCH] [Plugins] Move plugin-specific logger --- src/def.d.ts | 1 - src/lib/logger.ts | 2 +- src/lib/plugins.ts | 9 +++------ 3 files changed, 4 insertions(+), 8 deletions(-) diff --git a/src/def.d.ts b/src/def.d.ts index f499d8e..ce63dd2 100644 --- a/src/def.d.ts +++ b/src/def.d.ts @@ -375,7 +375,6 @@ interface VendettaObject { interface VendettaPluginObject { manifest: PluginManifest; storage: Indexable; - logger: Logger; } declare global { diff --git a/src/lib/logger.ts b/src/lib/logger.ts index 3bac60e..1e107df 100644 --- a/src/lib/logger.ts +++ b/src/lib/logger.ts @@ -1,7 +1,7 @@ import { Logger } from "@types"; import { findByProps } from "@metro/filters"; -const logModule = findByProps("setLogFn").default; +export const logModule = findByProps("setLogFn").default; const logger: Logger = new logModule("Vendetta"); export default logger; \ No newline at end of file diff --git a/src/lib/plugins.ts b/src/lib/plugins.ts index 78a69e3..19b1ca9 100644 --- a/src/lib/plugins.ts +++ b/src/lib/plugins.ts @@ -1,10 +1,7 @@ import { Indexable, PluginManifest, Plugin } from "@types"; import { awaitSyncWrapper, createMMKVBackend, createStorage, wrapSync } from "@lib/storage"; -import { findByProps } from "@metro/filters"; +import logger, { logModule } from "@lib/logger"; import safeFetch from "@utils/safeFetch"; -import logger from "@lib/logger"; - -const logModule = findByProps("setLogFn").default; type EvaledPlugin = { onLoad?(): void; @@ -63,8 +60,8 @@ export async function evalPlugin(plugin: Plugin) { manifest: plugin.manifest, // Wrapping this with wrapSync is NOT an option. storage: await createStorage>(createMMKVBackend(plugin.id)), - logger: new logModule(plugin.manifest.name), - } + }, + logger: new logModule(`Vendetta ยป ${plugin.manifest.name}`), }; const pluginString = `vendetta=>{return ${plugin.js}}\n//# sourceURL=${plugin.id}`;