From 5c3324c120c518f434f5723d9c308fcd4f8e8091 Mon Sep 17 00:00:00 2001 From: optrader Date: Mon, 24 Nov 2025 12:13:09 +0900 Subject: [PATCH] =?UTF-8?q?[251124]=20fix:=20Log=EC=A0=95=EB=A6=AC-3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ๐Ÿ• ์ปค๋ฐ‹ ์‹œ๊ฐ„: 2025. 11. 24. 12:13:08 ๐Ÿ“Š ๋ณ€๊ฒฝ ํ†ต๊ณ„: โ€ข ์ด ํŒŒ์ผ: 10๊ฐœ โ€ข ์ถ”๊ฐ€: +29์ค„ โ€ข ์‚ญ์ œ: -110์ค„ ๐Ÿ“ ์ถ”๊ฐ€๋œ ํŒŒ์ผ: + com.twin.app.shoptime/src/utils/debug.js ๐Ÿ“ ์ˆ˜์ •๋œ ํŒŒ์ผ: ~ com.twin.app.shoptime/src/actions/playActions.js ~ com.twin.app.shoptime/src/actions/productActions.js ~ com.twin.app.shoptime/src/components/VideoPlayer/VideoPlayer.js ~ com.twin.app.shoptime/src/hooks/useFocusHistory/useFocusHistory.js ~ com.twin.app.shoptime/src/lunaSend/common.js ~ com.twin.app.shoptime/src/reducers/panelReducer.js ~ com.twin.app.shoptime/src/views/HomePanel/HomePanel.jsx ~ com.twin.app.shoptime/src/views/MyPagePanel/MyPageSub/TermsOfService/TermsOfOptional.jsx ~ com.twin.app.shoptime/src/views/PlayerPanel/PlayerPanel.jsx ๐Ÿ”ง ํ•จ์ˆ˜ ๋ณ€๊ฒฝ ๋‚ด์šฉ: ๐Ÿ“„ com.twin.app.shoptime/src/actions/playActions.js (javascript): โŒ Deleted: dwarn(), derror() ๐Ÿ“„ com.twin.app.shoptime/src/actions/productActions.js (javascript): โŒ Deleted: dwarn(), derror() ๐Ÿ“„ com.twin.app.shoptime/src/components/VideoPlayer/VideoPlayer.js (javascript): โŒ Deleted: dwarn(), derror() ๐Ÿ“„ com.twin.app.shoptime/src/hooks/useFocusHistory/useFocusHistory.js (javascript): โŒ Deleted: dwarn(), derror() ๐Ÿ“„ com.twin.app.shoptime/src/lunaSend/common.js (javascript): โŒ Deleted: dwarn(), derror() ๐Ÿ“„ com.twin.app.shoptime/src/reducers/panelReducer.js (javascript): โŒ Deleted: dwarn(), derror() ๐Ÿ“„ com.twin.app.shoptime/src/views/HomePanel/HomePanel.jsx (javascript): โŒ Deleted: dwarn(), derror() ๐Ÿ“„ com.twin.app.shoptime/src/views/MyPagePanel/MyPageSub/TermsOfService/TermsOfOptional.jsx (javascript): โŒ Deleted: dwarn(), derror() ๐Ÿ“„ com.twin.app.shoptime/src/views/PlayerPanel/PlayerPanel.jsx (javascript): โŒ Deleted: dwarn(), derror() ๐Ÿ”ง ์ฃผ์š” ๋ณ€๊ฒฝ ๋‚ด์šฉ: โ€ข ํ•ต์‹ฌ ๋น„์ฆˆ๋‹ˆ์Šค ๋กœ์ง ๊ฐœ์„  โ€ข UI ์ปดํฌ๋„ŒํŠธ ์•„ํ‚คํ…์ฒ˜ ๊ฐœ์„  โ€ข API ์„œ๋น„์Šค ๋ ˆ์ด์–ด ๊ฐœ์„  โ€ข ๊ณตํ†ต ์œ ํ‹ธ๋ฆฌํ‹ฐ ํ•จ์ˆ˜ ์ตœ์ ํ™” Performance: ์ฝ”๋“œ ์ตœ์ ํ™”๋กœ ์„ฑ๋Šฅ ๊ฐœ์„  ๊ธฐ๋Œ€ --- .../src/actions/playActions.js | 15 ++---- .../src/actions/productActions.js | 13 ++--- .../src/components/VideoPlayer/VideoPlayer.js | 16 ++---- .../hooks/useFocusHistory/useFocusHistory.js | 14 ++--- com.twin.app.shoptime/src/lunaSend/common.js | 16 ++---- .../src/reducers/panelReducer.js | 16 ++---- com.twin.app.shoptime/src/utils/debug.js | 53 +++++++++++++++++++ .../src/views/HomePanel/HomePanel.jsx | 16 ++---- .../TermsOfService/TermsOfOptional.jsx | 17 ++---- .../src/views/PlayerPanel/PlayerPanel.jsx | 16 ++---- 10 files changed, 82 insertions(+), 110 deletions(-) create mode 100644 com.twin.app.shoptime/src/utils/debug.js diff --git a/com.twin.app.shoptime/src/actions/playActions.js b/com.twin.app.shoptime/src/actions/playActions.js index 71eea907..22449125 100644 --- a/com.twin.app.shoptime/src/actions/playActions.js +++ b/com.twin.app.shoptime/src/actions/playActions.js @@ -5,20 +5,11 @@ import { TAxios } from '../api/TAxios'; import { panel_names } from '../utils/Config'; import { types } from './actionTypes'; import { popPanel, pushPanel, updatePanel } from './panelActions'; +import { createDebugHelpers } from '../utils/debug'; +// ๋””๋ฒ„๊ทธ ํ—ฌํผ ์„ค์ • const DEBUG_MODE = false; - -const dlog = (...args) => { - if (DEBUG_MODE) console.log(...args); -}; - -const dwarn = (...args) => { - if (DEBUG_MODE) console.warn(...args); -}; - -const derror = (...args) => { - console.error(...args); -}; +const { dlog, dwarn, derror } = createDebugHelpers(DEBUG_MODE); // ๐Ÿ”ฝ [251116] ์ƒˆ๋กœ์šด ๋น„๋””์˜ค ์ƒํƒœ ๊ด€๋ฆฌ ์‹œ์Šคํ…œ - ์žฌ์ƒ ์ƒํƒœ export const PLAYBACK_STATUS = { diff --git a/com.twin.app.shoptime/src/actions/productActions.js b/com.twin.app.shoptime/src/actions/productActions.js index fe0b7797..62c1d926 100644 --- a/com.twin.app.shoptime/src/actions/productActions.js +++ b/com.twin.app.shoptime/src/actions/productActions.js @@ -3,6 +3,7 @@ import { TAxios } from '../api/TAxios'; import { types } from './actionTypes'; import { changeAppStatus } from './commonActions'; import { reduce, set, get } from '../utils/fp'; +import { createDebugHelpers } from '../utils/debug'; // CustomerImages์šฉ ๋ฆฌ๋ทฐ ์ด๋ฏธ์ง€ import import reviewSampleImage from '../../assets/images/image-review-sample-1.png'; @@ -10,16 +11,8 @@ import reviewSampleImage from '../../assets/images/image-review-sample-1.png'; // DEBUG_MODE - true์ธ ๊ฒฝ์šฐ์—๋งŒ ๋กœ๊ทธ ์ถœ๋ ฅ const DEBUG_MODE = false; -// Local debug helpers (matches src/lunaSend/common.js pattern) -const dlog = (...args) => { - if (DEBUG_MODE) console.log(...args); -}; -const dwarn = (...args) => { - if (DEBUG_MODE) console.warn(...args); -}; -const derror = (...args) => { - if (DEBUG_MODE) console.error(...args); -}; +// ์ด ํŒŒ์ผ์˜ DEBUG_MODE๋ฅผ ์‚ฌ์šฉํ•˜์—ฌ ํ—ฌํผ ์ƒ์„ฑ +const { dlog, dwarn, derror } = createDebugHelpers(DEBUG_MODE); // Best Seller ์ƒํ’ˆ ๋ชฉ๋ก ์กฐํšŒ IF-LGSP-303 // FP helpers diff --git a/com.twin.app.shoptime/src/components/VideoPlayer/VideoPlayer.js b/com.twin.app.shoptime/src/components/VideoPlayer/VideoPlayer.js index bb589a8d..292f1e40 100644 --- a/com.twin.app.shoptime/src/components/VideoPlayer/VideoPlayer.js +++ b/com.twin.app.shoptime/src/components/VideoPlayer/VideoPlayer.js @@ -48,6 +48,7 @@ import Touchable from '@enact/ui/Touchable'; import { panel_names } from '../../utils/Config'; import { $L } from '../../utils/helperMethods'; +import { createDebugHelpers } from '../../utils/debug'; import { SpotlightIds } from '../../utils/SpotlightIds'; import ThemeIndicator from '../../views/DetailPanel/components/indicator/ThemeIndicator'; import ThemeIndicatorArrow from '../../views/DetailPanel/components/indicator/ThemeIndicatorArrow'; @@ -66,20 +67,9 @@ import Video from './Video'; import css from './VideoPlayer.module.less'; import { updateVideoPlayState } from '../../actions/playActions'; -// Toggle debug logging for this module +// ๋””๋ฒ„๊ทธ ํ—ฌํผ ์„ค์ • const DEBUG_MODE = false; - -const dlog = (...args) => { - if (DEBUG_MODE) console.log(...args); -}; - -const dwarn = (...args) => { - if (DEBUG_MODE) console.warn(...args); -}; - -const derror = (...args) => { - console.error(...args); -}; +const { dlog, dwarn, derror } = createDebugHelpers(DEBUG_MODE); const isEnter = is('enter'); const isLeft = is('left'); diff --git a/com.twin.app.shoptime/src/hooks/useFocusHistory/useFocusHistory.js b/com.twin.app.shoptime/src/hooks/useFocusHistory/useFocusHistory.js index d8e50622..df23be1e 100644 --- a/com.twin.app.shoptime/src/hooks/useFocusHistory/useFocusHistory.js +++ b/com.twin.app.shoptime/src/hooks/useFocusHistory/useFocusHistory.js @@ -2,21 +2,13 @@ import { useRef, useCallback, useState, useMemo } from 'react'; import fp from '../../utils/fp.js'; +import { createDebugHelpers } from '../../utils/debug'; // Toggle debug logging in this file (false by default) const DEBUG_MODE = false; -const dlog = (...args) => { - if (DEBUG_MODE) console.log(...args); -}; - -const dwarn = (...args) => { - if (DEBUG_MODE) console.warn(...args); -}; - -const derror = (...args) => { - console.error(...args); -}; +// ์ด ํŒŒ์ผ์˜ DEBUG_MODE๋ฅผ ์‚ฌ์šฉํ•˜์—ฌ ํ—ฌํผ ์ƒ์„ฑ +const { dlog, dwarn, derror, debugIf } = createDebugHelpers(DEBUG_MODE); /** * useFocusHistory Hook - ๊ฒฝ๋Ÿ‰ํ™”๋œ ํฌ์ปค์Šค ํžˆ์Šคํ† ๋ฆฌ ๊ด€๋ฆฌ diff --git a/com.twin.app.shoptime/src/lunaSend/common.js b/com.twin.app.shoptime/src/lunaSend/common.js index 708267ff..57f4856b 100644 --- a/com.twin.app.shoptime/src/lunaSend/common.js +++ b/com.twin.app.shoptime/src/lunaSend/common.js @@ -2,21 +2,11 @@ import appinfo from '../../webos-meta/appinfo.json'; import { alertToast } from '../actions/commonActions'; import { store } from '../store/store'; import LS2Request from './LS2Request'; +import { createDebugHelpers } from '../utils/debug'; -// Toggle debug logging for this module (false by default) +// ๋””๋ฒ„๊ทธ ํ—ฌํผ ์„ค์ • const DEBUG_MODE = false; - -const dlog = (...args) => { - if (DEBUG_MODE) console.log(...args); -}; - -const dwarn = (...args) => { - if (DEBUG_MODE) console.warn(...args); -}; - -const derror = (...args) => { - console.error(...args); -}; +const { dlog, dwarn, derror } = createDebugHelpers(DEBUG_MODE); export const getConnectionStatus = ({ onSuccess, onFailure, onComplete }) => { if (typeof window === 'object' && !window.PalmSystem) { diff --git a/com.twin.app.shoptime/src/reducers/panelReducer.js b/com.twin.app.shoptime/src/reducers/panelReducer.js index dabb2c3f..953409f3 100644 --- a/com.twin.app.shoptime/src/reducers/panelReducer.js +++ b/com.twin.app.shoptime/src/reducers/panelReducer.js @@ -1,20 +1,10 @@ import { types } from '../actions/actionTypes'; import { panel_names } from '../utils/Config'; +import { createDebugHelpers } from '../utils/debug'; -// Toggle debug logging for this reducer +// ๋””๋ฒ„๊ทธ ํ—ฌํผ ์„ค์ • const DEBUG_MODE = false; - -const dlog = (...args) => { - if (DEBUG_MODE) console.log(...args); -}; - -const dwarn = (...args) => { - if (DEBUG_MODE) console.warn(...args); -}; - -const derror = (...args) => { - console.error(...args); -}; +const { dlog, dwarn, derror } = createDebugHelpers(DEBUG_MODE); const initialState = { // ๊ธฐ์กด ์ƒํƒœ - ์™„์ „ํžˆ ํ˜ธํ™˜๋จ diff --git a/com.twin.app.shoptime/src/utils/debug.js b/com.twin.app.shoptime/src/utils/debug.js new file mode 100644 index 00000000..adba6d51 --- /dev/null +++ b/com.twin.app.shoptime/src/utils/debug.js @@ -0,0 +1,53 @@ +/** + * Shared Debug Utilities + * + * ์‚ฌ์šฉ ๋ฐฉ๋ฒ•: + * + * 1. ๊ฐ ํŒŒ์ผ์—์„œ DEBUG_MODE ์ •์˜: + * const DEBUG_MODE = false; // ๋˜๋Š” true + * + * 2. ํ—ฌํผ๋“ค์„ createDebugHelpers๋กœ ๊ฐ์‹ธ๊ธฐ: + * import { createDebugHelpers } from '../utils/debug'; + * const { dlog, dwarn, derror } = createDebugHelpers(DEBUG_MODE); + * + * 3. ์‚ฌ์šฉ: + * dlog('message', data); // DEBUG_MODE๊ฐ€ true์ผ ๋•Œ๋งŒ ์‹คํ–‰ + * dwarn('warning'); + * derror('error'); + * + * ๊ฐ ํŒŒ์ผ๋งˆ๋‹ค ๋…๋ฆฝ์ ์ธ DEBUG_MODE๋ฅผ ์œ ์ง€ํ•˜๋ฉด์„œ ํ—ฌํผ ์ฝ”๋“œ๋Š” ๊ณต์œ ๋ฉ๋‹ˆ๋‹ค. + */ + +/** + * ๋””๋ฒ„๊ทธ ํ—ฌํผ ํŒฉํ† ๋ฆฌ ํ•จ์ˆ˜ + * ๊ฐ ํŒŒ์ผ์—์„œ ์ž์‹ ์˜ DEBUG_MODE๋ฅผ ์ „๋‹ฌํ•˜์—ฌ ๊ณ ์œ ํ•œ ํ—ฌํผ ์ธ์Šคํ„ด์Šค ์ƒ์„ฑ + * @param {boolean} debugMode - ํ•ด๋‹น ํŒŒ์ผ์˜ DEBUG_MODE ๊ฐ’ + * @returns {object} { dlog, dwarn, derror } ํ—ฌํผ ํ•จ์ˆ˜๋“ค + */ +export const createDebugHelpers = (debugMode = false) => ({ + dlog: (...args) => { + if (debugMode) console.log(...args); + }, + dwarn: (...args) => { + if (debugMode) console.warn(...args); + }, + derror: (...args) => { + if (debugMode) console.error(...args); + }, + debugIf: (callback) => { + if (debugMode && typeof callback === 'function') callback(); + }, +}); + +/** + * ๊ฐ„๋‹จํ•œ ๋ฒ„์ „ (๊ธฐ์กด ๋ฐฉ์‹๊ณผ ํ˜ธํ™˜) + * ๊ฐœ๋ณ„ ํ—ฌํผ๋“ค์„ ์ง์ ‘ export (ํ•˜์ง€๋งŒ ์ผ๋ฐ˜์ ์œผ๋กœ createDebugHelpers ๊ถŒ์žฅ) + */ +export const createSimpleHelpers = () => { + // ๊ธฐ๋ณธ๊ฐ’์œผ๋กœ๋Š” ๋ชจ๋‘ ๋น„ํ™œ์„ฑํ™” (๊ฐ ํŒŒ์ผ์—์„œ ๋ช…์‹œ์ ์œผ๋กœ ํ™œ์„ฑํ™”ํ•ด์•ผ ํ•จ) + return { + dlog: () => {}, + dwarn: () => {}, + derror: () => {}, + }; +}; diff --git a/com.twin.app.shoptime/src/views/HomePanel/HomePanel.jsx b/com.twin.app.shoptime/src/views/HomePanel/HomePanel.jsx index 5ef3e078..0e024f02 100644 --- a/com.twin.app.shoptime/src/views/HomePanel/HomePanel.jsx +++ b/com.twin.app.shoptime/src/views/HomePanel/HomePanel.jsx @@ -52,21 +52,11 @@ import { useFocusHistory } from '../../hooks/useFocusHistory/useFocusHistory'; import usePrevious from '../../hooks/usePrevious'; import { useVideoPlay } from '../../hooks/useVideoPlay/useVideoPlay'; import ImagePreloader from '../../utils/ImagePreloader'; +import { createDebugHelpers } from '../../utils/debug'; -// Toggle debug logging for this module (false by default) +// ๋””๋ฒ„๊ทธ ํ—ฌํผ ์„ค์ • const DEBUG_MODE = false; - -const dlog = (...args) => { - if (DEBUG_MODE) console.log(...args); -}; - -const dwarn = (...args) => { - if (DEBUG_MODE) console.warn(...args); -}; - -const derror = (...args) => { - console.error(...args); -}; +const { dlog, dwarn, derror } = createDebugHelpers(DEBUG_MODE); // DetailPanelBackground ์ด๋ฏธ์ง€ imports for preloading import hsn from '../../../assets/images/bg/hsn_new.png'; diff --git a/com.twin.app.shoptime/src/views/MyPagePanel/MyPageSub/TermsOfService/TermsOfOptional.jsx b/com.twin.app.shoptime/src/views/MyPagePanel/MyPageSub/TermsOfService/TermsOfOptional.jsx index 5225cdbb..68579862 100644 --- a/com.twin.app.shoptime/src/views/MyPagePanel/MyPageSub/TermsOfService/TermsOfOptional.jsx +++ b/com.twin.app.shoptime/src/views/MyPagePanel/MyPageSub/TermsOfService/TermsOfOptional.jsx @@ -13,6 +13,7 @@ import React, { useCallback, useEffect, useState, useMemo } from 'react'; import { useDispatch, useSelector } from 'react-redux'; import Spotlight from '@enact/spotlight'; +import { createDebugHelpers } from '../../../../utils/debug'; import { setHidePopup, @@ -51,6 +52,10 @@ import TPanel from '../../../../components/TPanel/TPanel'; import TermsPopup from './TermsPopup'; import OptionalTermsInfo from './OptionalTermsInfo'; +// ๋””๋ฒ„๊ทธ ํ—ฌํผ ์„ค์ • +const DEBUG_MODE = false; +const { dlog, dwarn, derror } = createDebugHelpers(DEBUG_MODE); + // SVG ์•„์ด์ฝ˜ ์ปดํฌ๋„ŒํŠธ const ExpandIcon = ({ className }) => ( ( ); -// Local debug helpers (matches src/lunaSend/common.js pattern) -const DEBUG_MODE = false; -const dlog = (...args) => { - if (DEBUG_MODE) console.log(...args); -}; -const dwarn = (...args) => { - if (DEBUG_MODE) console.warn(...args); -}; -const derror = (...args) => { - if (DEBUG_MODE) console.error(...args); -}; - // ํ˜œํƒ ์ด๋ฏธ์ง€ ์ปดํฌ๋„ŒํŠธ const BenefitImage = ({ className, onClick }) => { return ( diff --git a/com.twin.app.shoptime/src/views/PlayerPanel/PlayerPanel.jsx b/com.twin.app.shoptime/src/views/PlayerPanel/PlayerPanel.jsx index 86a264e9..408c818e 100644 --- a/com.twin.app.shoptime/src/views/PlayerPanel/PlayerPanel.jsx +++ b/com.twin.app.shoptime/src/views/PlayerPanel/PlayerPanel.jsx @@ -9,6 +9,7 @@ import SpotlightContainerDecorator from '@enact/spotlight/SpotlightContainerDeco import { setContainerLastFocusedElement } from '@enact/spotlight/src/container'; import dummyVtt from '../../../assets/mock/video.vtt'; +import { createDebugHelpers } from '../../utils/debug'; import { changeAppStatus, changeLocalSettings, @@ -66,20 +67,9 @@ import TabContainerV2 from './PlayerTabContents/v2/TabContainer.v2'; const Container = SpotlightContainerDecorator({ enterTo: 'last-focused', preserveId: true }, 'div'); -// Toggle debug logging for this view +// ๋””๋ฒ„๊ทธ ํ—ฌํผ ์„ค์ • const DEBUG_MODE = false; - -const dlog = (...args) => { - if (DEBUG_MODE) console.log(...args); -}; - -const dwarn = (...args) => { - if (DEBUG_MODE) console.warn(...args); -}; - -const derror = (...args) => { - console.error(...args); -}; +const { dlog, dwarn, derror } = createDebugHelpers(DEBUG_MODE); const findSelector = (selector, maxAttempts = 5, currentAttempts = 0) => { try {