Skip to content

Commit

Permalink
Merge pull request #2854 from evidence-dev/hotfix/dev-server-logging
Browse files Browse the repository at this point in the history
[Hotfix] dev server logging
  • Loading branch information
zachstence authored Nov 25, 2024
2 parents 251ec81 + f1f7d93 commit b7088a6
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 6 deletions.
5 changes: 5 additions & 0 deletions .changeset/unlucky-ants-enjoy.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@evidence-dev/evidence': patch
---

re-enable logging on dev mode
3 changes: 2 additions & 1 deletion packages/evidence/cli.js
Original file line number Diff line number Diff line change
Expand Up @@ -173,7 +173,8 @@ const buildHelper = function (command, args) {
...process.env,
// used for source query HMR
EVIDENCE_DATA_URL_PREFIX: process.env.EVIDENCE_DATA_URL_PREFIX ?? 'static/data',
EVIDENCE_DATA_DIR: process.env.EVIDENCE_DATA_DIR ?? './static/data'
EVIDENCE_DATA_DIR: process.env.EVIDENCE_DATA_DIR ?? './static/data',
EVIDENCE_IS_BUILDING: 'true'
}
});
// Copy the outputs to the root of the project upon successful exit
Expand Down
13 changes: 8 additions & 5 deletions packages/evidence/scripts/build-template.js
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,14 @@ fsExtra.outputFileSync(
customLogger: logger
}
if (isDebug()) {
// Suppress errors when building in non-debug mode
if (!isDebug() && process.env.EVIDENCE_IS_BUILDING === 'true') {
config.logLevel = 'silent';
logger.error = (msg) => log.error(msg);
logger.info = () => {};
logger.warn = () => {};
logger.warnOnce = () => {};
} else {
const loggerWarn = logger.warn;
const loggerOnce = logger.warnOnce
Expand All @@ -124,10 +131,6 @@ fsExtra.outputFileSync(
loggerWarn(msg, options);
};
} else {
config.logLevel = 'silent';
logger.error = (msg) => log.error(msg);
logger.info = logger.warn = logger.warnOnce = () => {};
}
export default config`
Expand Down

0 comments on commit b7088a6

Please sign in to comment.