Skip to content

Commit

Permalink
chore(gatsby): only load the necessary logger (#33463)
Browse files Browse the repository at this point in the history
  • Loading branch information
wardpeet authored Oct 11, 2021
1 parent 57f581d commit 934035d
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions packages/gatsby-cli/src/reporter/start-logger.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,6 @@
*/
import semver from "semver"
import { isCI } from "gatsby-core-utils"
import { initializeIPCLogger } from "./loggers/ipc"
import { initializeJSONLogger } from "./loggers/json"
import { initializeYurnalistLogger } from "./loggers/yurnalist"
import { initializeINKLogger } from "./loggers/ink"

export const startLogger = (): void => {
if (!process.env.GATSBY_LOGGER) {
Expand All @@ -26,14 +22,18 @@ export const startLogger = (): void => {
// This is just workaround to not crash process when reporter is used in worker context.
// process.env.FORCE_COLOR = `0`

initializeIPCLogger()
// TODO move to dynamic imports
require(`./loggers/ipc`).initializeIPCLogger()
}

if (process.env.GATSBY_LOGGER.includes(`json`)) {
initializeJSONLogger()
// TODO move to dynamic imports
require(`./loggers/json`).initializeJSONLogger()
} else if (process.env.GATSBY_LOGGER.includes(`yurnalist`)) {
initializeYurnalistLogger()
// TODO move to dynamic imports
require(`./loggers/yurnalist`).initializeYurnalistLogger()
} else {
initializeINKLogger()
// TODO move to dynamic imports
require(`./loggers/ink`).initializeINKLogger()
}
}

0 comments on commit 934035d

Please sign in to comment.