mirror of
https://github.com/unraid/api.git
synced 2026-02-18 14:08:29 -06:00
refactor: remove console outputs for prod builds
This commit is contained in:
@@ -2,6 +2,9 @@
|
||||
import { provide } from 'vue';
|
||||
import { createI18n, I18nInjectionKey } from 'vue-i18n';
|
||||
|
||||
import { disableProductionConsoleLogs } from '~/helpers/functions';
|
||||
disableProductionConsoleLogs();
|
||||
|
||||
import en_US from '~/locales/en_US.json'; // eslint-disable-line camelcase
|
||||
// import ja from '~/locales/ja.json';
|
||||
|
||||
|
||||
@@ -1,7 +1,10 @@
|
||||
/**
|
||||
* @name OBJ_TO_STR
|
||||
* @param {object} obj
|
||||
* @returns {String}
|
||||
* @description Output key + value for each item in the object. Adds new line after each item.
|
||||
*/
|
||||
export const OBJ_TO_STR = obj => Object.entries(obj).reduce((str, [p, val]) => `${str}${p}: ${val}\n`, '');
|
||||
/** Output key + value as string for each item in the object. Adds new line after each item. */
|
||||
export const OBJ_TO_STR = (obj: object): string => Object.entries(obj).reduce((str, [p, val]) => `${str}${p}: ${val}\n`, '');
|
||||
/** Removes our dev logs from prod builds */
|
||||
export const disableProductionConsoleLogs = () => {
|
||||
if (import.meta.env.PROD) {
|
||||
console.log = () => {};
|
||||
console.debug = () => {};
|
||||
console.info = () => {};
|
||||
}
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user