use proper loggers

This commit is contained in:
Vendicated 2025-02-06 04:00:14 +01:00
parent 4ee57da6f3
commit 2e72fa6589
No known key found for this signature in database
GPG key ID: D66986BAF75ECF18
4 changed files with 19 additions and 4 deletions

View file

@ -7,6 +7,7 @@
import { filters, waitFor } from "@vencord/types/webpack"; import { filters, waitFor } from "@vencord/types/webpack";
import { RelationshipStore } from "@vencord/types/webpack/common"; import { RelationshipStore } from "@vencord/types/webpack/common";
import { VesktopLogger } from "./logger";
import { Settings } from "./settings"; import { Settings } from "./settings";
let GuildReadStateStore: any; let GuildReadStateStore: any;
@ -26,7 +27,7 @@ export function setBadge() {
VesktopNative.app.setBadgeCount(totalCount); VesktopNative.app.setBadgeCount(totalCount);
} catch (e) { } catch (e) {
console.error(e); VesktopLogger.error("Failed to update badge count", e);
} }
} }

View file

@ -4,6 +4,7 @@
* Copyright (c) 2023 Vendicated and Vencord contributors * Copyright (c) 2023 Vendicated and Vencord contributors
*/ */
import { Logger } from "@vencord/types/utils";
import { findLazy, findStoreLazy, onceReady } from "@vencord/types/webpack"; import { findLazy, findStoreLazy, onceReady } from "@vencord/types/webpack";
import { FluxDispatcher, InviteActions } from "@vencord/types/webpack/common"; import { FluxDispatcher, InviteActions } from "@vencord/types/webpack/common";
import { IpcCommands } from "shared/IpcEvents"; import { IpcCommands } from "shared/IpcEvents";
@ -11,6 +12,7 @@ import { IpcCommands } from "shared/IpcEvents";
import { onIpcCommand } from "./ipcCommands"; import { onIpcCommand } from "./ipcCommands";
import { Settings } from "./settings"; import { Settings } from "./settings";
const logger = new Logger("VesktopRPC", "#5865f2");
const StreamerModeStore = findStoreLazy("StreamerModeStore"); const StreamerModeStore = findStoreLazy("StreamerModeStore");
const arRPC = Vencord.Plugins.plugins["WebRichPresence (arRPC)"] as any as { const arRPC = Vencord.Plugins.plugins["WebRichPresence (arRPC)"] as any as {
@ -55,11 +57,12 @@ onIpcCommand(IpcCommands.RPC_INVITE, async code => {
const { DEEP_LINK } = findLazy(m => m.DEEP_LINK?.handler); const { DEEP_LINK } = findLazy(m => m.DEEP_LINK?.handler);
onIpcCommand(IpcCommands.RPC_DEEP_LINK, async data => { onIpcCommand(IpcCommands.RPC_DEEP_LINK, async data => {
logger.debug("Opening deep link:", data);
try { try {
DEEP_LINK.handler({ args: data }); DEEP_LINK.handler({ args: data });
return true; return true;
} catch (err) { } catch (err) {
console.error("[RPC]", "Failed to open deep link:", err, data); logger.error("Failed to open deep link:", err);
return false; return false;
} }
}); });

View file

@ -11,14 +11,16 @@ import "./patches";
import "./fixes"; import "./fixes";
import "./arrpc"; import "./arrpc";
console.log("read if cute :3");
export * as Components from "./components"; export * as Components from "./components";
import SettingsUi from "./components/settings/Settings"; import SettingsUi from "./components/settings/Settings";
import { VesktopLogger } from "./logger";
import { Settings } from "./settings"; import { Settings } from "./settings";
export { Settings }; export { Settings };
VesktopLogger.log("read if cute :3");
VesktopLogger.log("Vesktop v" + VesktopNative.app.getVersion());
const customSettingsSections = ( const customSettingsSections = (
Vencord.Plugins.plugins.Settings as any as { customSections: ((ID: Record<string, unknown>) => any)[] } Vencord.Plugins.plugins.Settings as any as { customSections: ((ID: Record<string, unknown>) => any)[] }
).customSections; ).customSections;

9
src/renderer/logger.ts Normal file
View file

@ -0,0 +1,9 @@
/*
* SPDX-License-Identifier: GPL-3.0
* Vesktop, a desktop app aiming to give you a snappier Discord Experience
* Copyright (c) 2023 Vendicated and Vencord contributors
*/
import { Logger } from "@vencord/types/utils";
export const VesktopLogger = new Logger("Vesktop", "#d3869b");