deezer-linux/patches/09-log-level-environment-variable.patch
2025-03-01 17:53:00 +00:00

73 lines
2.7 KiB
Diff
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

From 43e2a95ada8852ffda95a9ea08bb7914d26c6d2f Mon Sep 17 00:00:00 2001
From: josselinonduty <contact@josselinonduty.fr>
Date: Sat, 1 Feb 2025 19:05:39 +0100
Subject: [PATCH] fix: set default log level to "warn" to respect Deezer TOS
Original patch: Dorian Stoll <dorian.stoll@tmsp.io>
This stops the excessive logging, since parts of the app will not run in development
mode anymore. It also stops the app from logging the urls for the mp3 files, which is
against the Deezer TOS.
---
build/main.js | 39 ++++++++++++++++++++++++++++++++++-----
1 file changed, 34 insertions(+), 5 deletions(-)
diff --git a/build/main.js b/build/main.js
index 8b645c6..686ac80 100644
--- a/build/main.js
+++ b/build/main.js
@@ -67,6 +67,35 @@
var external_electron_log_default = __webpack_require__.n(
external_electron_log_namespaceObject
);
+ // function updateLogLevel() {
+ // const level = process.env.LOG_LEVEL;
+ // if (level) {
+ // if (level !== "silly")
+ // external_electron_log_default().silly = () => {};
+ // else return;
+
+ // if (level !== "debug")
+ // external_electron_log_default().debug = () => {};
+ // else return;
+
+ // if (level !== "verbose")
+ // external_electron_log_default().verbose = () => {};
+ // else return;
+
+ // if (level !== "info")
+ // external_electron_log_default().info = () => {};
+ // else return;
+
+ // if (level !== "warn")
+ // external_electron_log_default().warn = () => {};
+ // else return;
+
+ // if (level !== "error")
+ // external_electron_log_default().error = () => {};
+ // else return;
+ // }
+ // }
+ // updateLogLevel();
const external_electron_settings_namespaceObject = require("electron-settings");
var external_electron_settings_default = __webpack_require__.n(
external_electron_settings_namespaceObject
@@ -3329,11 +3358,11 @@
(external_electron_log_default().transports.console.format = `{h}:{i}:{s}.{ms} ({processType}/{level}) ${
isPlatform(PLATFORM.WINDOWS) ? ">" : ""
} {text}`),
- (external_electron_log_default().transports.console.level = isDev
- ? "silly"
+ (external_electron_log_default().transports.console.level = isDev({isPackaged: true}) || process.env.LOG_LEVEL
+ ? process.env.LOG_LEVEL
: "warn"),
- (external_electron_log_default().transports.file.level = isDev
- ? "silly"
+ (external_electron_log_default().transports.file.level = isDev({isPackaged: true}) || !process.env.LOG_LEVEL
+ ? process.env.LOG_LEVEL
: "warn"),
(external_electron_log_default().transports.sentry = function (msg) {
"error" === msg.level &&
--
2.43.0