diff --git a/.env.local b/.env.local index 3cf57133..c2daaaed 100644 --- a/.env.local +++ b/.env.local @@ -1,5 +1,5 @@ # 环境变量 @see https://www.nextjs.cn/docs/basic-features/environment-variables -NEXT_PUBLIC_VERSION=4.2.3 +NEXT_PUBLIC_VERSION=4.2.4 # 可在此添加环境变量,去掉最左边的(# )注释即可 diff --git a/lib/notion/getPostBlocks.js b/lib/notion/getPostBlocks.js index 7c085993..69888b5d 100644 --- a/lib/notion/getPostBlocks.js +++ b/lib/notion/getPostBlocks.js @@ -18,10 +18,7 @@ export async function getPostBlocks(id, from, slice) { return filterPostBlocks(id, pageBlock, slice) } - const start = new Date().getTime() pageBlock = await getPageWithRetry(id, from) - const end = new Date().getTime() - console.log('[API耗时]', `${end - start}ms`) if (pageBlock) { await setDataToCache(cacheKey, pageBlock) @@ -38,10 +35,7 @@ export async function getSingleBlock(id, from) { return pageBlock } - const start = new Date().getTime() pageBlock = await getPageWithRetry(id, from) - const end = new Date().getTime() - console.log('[API耗时]', `${end - start}ms`) if (pageBlock) { await setDataToCache(cacheKey, pageBlock) @@ -56,16 +50,17 @@ export async function getSingleBlock(id, from) { */ export async function getPageWithRetry(id, from, retryAttempts = 3) { if (retryAttempts && retryAttempts > 0) { - console.log('[请求API]', `from:${from}`, `id:${id}`, retryAttempts < 3 ? `剩余重试次数:${retryAttempts}` : '') + console.log('[API-->>请求]', `from:${from}`, `id:${id}`, retryAttempts < 3 ? `剩余重试次数:${retryAttempts}` : '') try { const authToken = BLOG.NOTION_ACCESS_TOKEN || null const api = new NotionAPI({ authToken, userTimeZone: Intl.DateTimeFormat().resolvedOptions().timeZone }) + const start = new Date().getTime() const pageData = await api.getPage(id) - // console.log('stringfy', JSON.stringify(pageData)) - console.info('[响应成功]:', `from:${from}`) + const end = new Date().getTime() + console.log('[API<<--响应]', `耗时:${end - start}ms - from:${from}`) return pageData } catch (e) { - console.warn('[响应异常]:', e) + console.warn('[API<<--异常]:', e) await delay(1000) const cacheKey = 'page_block_' + id const pageBlock = await getDataFromCache(cacheKey) diff --git a/next.config.js b/next.config.js index f6dc572b..d0e32e96 100644 --- a/next.config.js +++ b/next.config.js @@ -94,7 +94,7 @@ module.exports = withBundleAnalyzer({ // } // 动态主题:添加 resolve.alias 配置,将动态路径映射到实际路径 if (!isServer) { - console.log('加载默认主题', path.resolve(__dirname, 'themes', THEME)) + console.log('[加载主题]', path.resolve(__dirname, 'themes', THEME)) } config.resolve.alias['@theme-components'] = path.resolve(__dirname, 'themes', THEME) return config diff --git a/package.json b/package.json index df145844..82efcf06 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "notion-next", - "version": "4.2.3", + "version": "4.2.4", "homepage": "https://github.com/tangly1024/NotionNext.git", "license": "MIT", "repository": {