Hook with FB logger

Summary:
This change replaces the existing logging infra with the one defined and exposed in flipper-server-core.

Functionality remains the same with the addition of having support for Scribe.

Reviewed By: aigoncharov

Differential Revision: D48515246

fbshipit-source-id: 7970f6ad069821ee4f15136adc8da40d0b1fb0c7
This commit is contained in:
Lorenzo Blasa
2023-08-24 06:18:39 -07:00
committed by Facebook GitHub Bot
parent 87bf73f1d5
commit 6405a7bfdd
3 changed files with 35 additions and 90 deletions

View File

@@ -144,10 +144,17 @@ async function shutdown() {
}
async function start() {
console.info('[flipper-server][bootstrap] Booting up');
const t0 = performance.now();
const enhanceLogger = await initializeLogger(staticPath);
const isProduction =
process.env.NODE_ENV !== 'development' && process.env.NODE_ENV !== 'test';
const environmentInfo = await getEnvironmentInfo(
rootPath,
isProduction,
true,
);
await initializeLogger(environmentInfo, staticPath);
const t1 = performance.now();
const loggerInitializedMS = t1 - t0;
@@ -180,15 +187,6 @@ async function start() {
`[flipper-server][bootstrap] Keytar loaded (${keytarLoadedMS} ms)`,
);
const isProduction =
process.env.NODE_ENV !== 'development' && process.env.NODE_ENV !== 'test';
const environmentInfo = await getEnvironmentInfo(
rootPath,
isProduction,
true,
);
if (await checkPortInUse(argv.port)) {
console.warn(`[flipper-server] Port ${argv.port} is already in use`);
if (!argv.replace) {
@@ -237,10 +235,6 @@ async function start() {
await flipperServer.close();
});
enhanceLogger((logEntry) => {
flipperServer.emit('server-log', logEntry);
});
const companionEnv = await initCompanionEnv(flipperServer);
const t6 = performance.now();