Просмотр исходного кода

fix: remove log level check from warn

Sven 1 год назад
Родитель
Сommit
53f8631eb5
2 измененных файлов с 8 добавлено и 12 удалено
  1. 2 2
      src/tools/post-build.ts
  2. 6 10
      src/utils.ts

+ 2 - 2
src/tools/post-build.ts

@@ -94,10 +94,10 @@ I welcome every contribution on GitHub!
         MODE: mode,
         BRANCH: branch,
         BUILD_NUMBER: lastCommitSha,
-      }, 
+      },
     )
       // needs special treatment because the double quotes need to be replaced with backticks
-      .replace(/"(\/\*)?{{GLOBAL_STYLE}}(\*\/)?"/gm, `/* BetterYTM - global style */${mode === "development" ? "\n" : ""}\`${globalStyle}\``);
+      .replace(/"(\/\*)?{{GLOBAL_STYLE}}(\*\/)?"/gm, `\`${globalStyle}\``);
 
     if(mode === "production")
       userscript = remSourcemapComments(userscript);

+ 6 - 10
src/utils.ts

@@ -29,7 +29,7 @@ const consPrefix = `[${scriptInfo.name}]`;
 const consPrefixDbg = `[${scriptInfo.name}/#DEBUG]`;
 
 /**
- * Logs string-compatible values to the console, as long as the log level is sufficient.  
+ * Logs all passed values to the console, as long as the log level is sufficient.  
  * @param args Last parameter is log level (0 = Debug, 1/undefined = Info) - any number as the last parameter will be stripped out! Convert to string if they shouldn't be.
  */
 export function log(...args: unknown[]): void {
@@ -38,7 +38,7 @@ export function log(...args: unknown[]): void {
 }
 
 /**
- * Logs string-compatible values to the console as info, as long as the log level is sufficient.  
+ * Logs all passed values to the console as info, as long as the log level is sufficient.  
  * @param args Last parameter is log level (0 = Debug, 1/undefined = Info) - any number as the last parameter will be stripped out! Convert to string if they shouldn't be.
  */
 export function info(...args: unknown[]): void {
@@ -46,21 +46,17 @@ export function info(...args: unknown[]): void {
     console.info(consPrefix, ...args);
 }
 
-/**
- * Logs string-compatible values to the console as a warning, as long as the log level is sufficient.  
- * @param args Last parameter is log level (0 = Debug, 1/undefined = Info) - any number as the last parameter will be stripped out! Convert to string if they shouldn't be.
- */
+/** Logs all passed values to the console as a warning, no matter the log level. */
 export function warn(...args: unknown[]): void {
-  if(curLogLevel <= getLogLevel(args))
-    console.warn(consPrefix, ...args);
+  console.warn(consPrefix, ...args);
 }
 
-/** Logs string-compatible values to the console as an error, no matter the log level. */
+/** Logs all passed values to the console as an error, no matter the log level. */
 export function error(...args: unknown[]): void {
   console.error(consPrefix, ...args);
 }
 
-/** Logs string-compatible values to the console, intended for debugging only */
+/** Logs all passed values to the console with a debug-specific prefix */
 export function dbg(...args: unknown[]): void {
   console.log(consPrefixDbg, ...args);
 }