diff --git a/main.js b/main.js index d996d29..64d9d0b 100644 --- a/main.js +++ b/main.js @@ -81,26 +81,29 @@ function getBaseLogFilePath() { return customPath || getDefaultLogFilePath(); } -// Session log: one file per app session, created lazily on first upload -let sessionLogPath = null; +// Daily log: one file per day, reused across sessions on the same day +let _dailyLogPath = null; +let _dailyLogDate = null; function getLogFilePath() { const config = configStore.load(); - const useSessionLog = config && config.globalSettings && config.globalSettings.sessionLog; - if (!useSessionLog) return getBaseLogFilePath(); + const useDailyLog = config && config.globalSettings && config.globalSettings.sessionLog; + if (!useDailyLog) return getBaseLogFilePath(); - // Lazy: generate session log path on first call - if (!sessionLogPath) { + const now = new Date(); + const pad = (n) => String(n).padStart(2, '0'); + const today = `${now.getFullYear()}-${pad(now.getMonth() + 1)}-${pad(now.getDate())}`; + + // Reuse path if same day, otherwise generate new + if (_dailyLogDate !== today) { const base = getBaseLogFilePath(); const dir = path.dirname(base); const ext = path.extname(base); const name = path.basename(base, ext); - const now = new Date(); - const pad = (n) => String(n).padStart(2, '0'); - const ts = `${now.getFullYear()}-${pad(now.getMonth() + 1)}-${pad(now.getDate())}_${pad(now.getHours())}-${pad(now.getMinutes())}-${pad(now.getSeconds())}`; - sessionLogPath = path.join(dir, `${name}-${ts}${ext}`); + _dailyLogPath = path.join(dir, `${name}-${today}${ext}`); + _dailyLogDate = today; } - return sessionLogPath; + return _dailyLogPath; } function appendUploadLog(hoster, link, fileName) { diff --git a/renderer/app.js b/renderer/app.js index f5d0d56..c6c9983 100644 --- a/renderer/app.js +++ b/renderer/app.js @@ -1890,7 +1890,7 @@ function renderSettings() {
- +