Skip to content

Commit

Permalink
🎨 优化日志打印
Browse files Browse the repository at this point in the history
  • Loading branch information
zkqiang committed Mar 26, 2022
1 parent c6a6a59 commit 28e264a
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 10 deletions.
8 changes: 6 additions & 2 deletions scripts/events/lib/hello.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,11 @@
'use strict';

module.exports = (hexo) => {
const isZh = hexo.theme.i18n.languages[0].search(/zh-CN/i) !== -1;
if (isZh) {
if (hexo.theme.has_hello) {
return;
}

if (hexo.theme.i18n.languages[0].search(/zh-CN/i) !== -1) {
hexo.log.info(`
------------------------------------------------
| |
Expand Down Expand Up @@ -36,4 +39,5 @@ module.exports = (hexo) => {
`);
}

hexo.theme.has_hello = true;
};
16 changes: 8 additions & 8 deletions scripts/events/lib/merge-configs.js
Original file line number Diff line number Diff line change
Expand Up @@ -50,37 +50,37 @@ module.exports = (hexo) => {
mergeLang(language);
}
if (isZh) {
hexo.log.info('[Fluid] 读取 source/_data/languages/*.yml 文件覆盖语言配置');
hexo.log.debug('[Fluid] 读取 source/_data/languages/*.yml 文件覆盖语言配置');
} else {
hexo.log.info('[Fluid] Merge language config from source/_data/languages/*.yml');
hexo.log.debug('[Fluid] Merge language config from source/_data/languages/*.yml');
}
}
}

if (isNotEmptyObject(hexo.config.theme_config)) {
hexo.theme.config = objUtil.merge({}, hexo.theme.config, hexo.config.theme_config);
if (isZh) {
hexo.log.info('[Fluid] 读取 _config.yml 中 theme_config 配置项覆盖主题配置');
hexo.log.debug('[Fluid] 读取 _config.yml 中 theme_config 配置项覆盖主题配置');
} else {
hexo.log.info('[Fluid] Merge theme config from theme_config in _config.yml');
hexo.log.debug('[Fluid] Merge theme config from theme_config in _config.yml');
}
}

if (isNotEmptyObject(dataStaticConfig)) {
hexo.theme.config.static_prefix = objUtil.merge({}, hexo.theme.config.static_prefix, dataStaticConfig);
if (isZh) {
hexo.log.info('[Fluid] 读取 source/_data/fluid_static_prefix.yml 文件覆盖主题配置');
hexo.log.debug('[Fluid] 读取 source/_data/fluid_static_prefix.yml 文件覆盖主题配置');
} else {
hexo.log.info('[Fluid] Merge theme config from source/_data/fluid_static_prefix.yml');
hexo.log.debug('[Fluid] Merge theme config from source/_data/fluid_static_prefix.yml');
}
}

if (isNotEmptyObject(dataConfig)) {
hexo.theme.config = objUtil.merge({}, hexo.theme.config, dataConfig);
if (isZh) {
hexo.log.info('[Fluid] 读取 source/_data/fluid_config.yml 文件覆盖主题配置');
hexo.log.debug('[Fluid] 读取 source/_data/fluid_config.yml 文件覆盖主题配置');
} else {
hexo.log.info('[Fluid] Merge theme config from source/_data/fluid_config.yml');
hexo.log.debug('[Fluid] Merge theme config from source/_data/fluid_config.yml');
}
}

Expand Down

0 comments on commit 28e264a

Please sign in to comment.