Skip to content

Commit ba7db63

Browse files
authored
Feat/remove config logs (#923)
* no sth/sequence config logs for non development env
1 parent 5daaf8e commit ba7db63

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

packages/host/src/lib/host.ts

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ import { SocketServer } from "./socket-server";
3838
import { DataStream } from "scramjet";
3939
import { optionsMiddleware } from "./middlewares/options";
4040
import { corsMiddleware } from "./middlewares/cors";
41-
import { ConfigService } from "@scramjet/sth-config";
41+
import { ConfigService, development } from "@scramjet/sth-config";
4242
import { isStartSequenceDTO, readJsonFile, defer, FileBuilder } from "@scramjet/utility";
4343
import { inspect } from "util";
4444
import { auditMiddleware, logger as auditMiddlewareLogger } from "./middlewares/audit";
@@ -63,6 +63,7 @@ const PARALLEL_SEQUENCE_STARTUP = 4;
6363

6464
type HostSizes = "xs" | "s" | "m" | "l" | "xl";
6565
const GigaByte = 1024 << 20;
66+
const isDevelopment = development();
6667

6768
/**
6869
* Host provides functionality to manage Instances and Sequences.
@@ -207,7 +208,7 @@ export class Host implements IComponent {
207208

208209
prettyLog.pipe(process.stdout);
209210

210-
this.logger.info("config", this.config);
211+
if (isDevelopment) this.logger.info("config", this.config);
211212

212213
this.config.host.id ||= this.getId();
213214
this.logger.updateBaseLog({ id: this.config.host.id });
@@ -775,7 +776,7 @@ export class Host implements IComponent {
775776
this.sequenceStore.set({ id, config, instances: [], name: sequenceName, location: "STH" });
776777
}
777778

778-
this.logger.info("Sequence identified", config);
779+
this.logger.trace(`Sequence identified: ${config.id}`);
779780

780781
// eslint-disable-next-line max-len
781782
await this.cpmConnector?.sendSequenceInfo(id, SequenceMessageCode.SEQUENCE_CREATED, config as unknown as GetSequenceResponse);
@@ -971,7 +972,7 @@ export class Host implements IComponent {
971972
const communicationHandler = new CommunicationHandler();
972973
const id = payload.instanceId || IDProvider.generate();
973974

974-
this.logger.debug("CSIC start payload", payload);
975+
if (isDevelopment) this.logger.debug("CSIC start payload", payload);
975976

976977
const csic = new CSIController(id, sequence, payload, communicationHandler, this.config, this.instanceProxy);
977978

0 commit comments

Comments
 (0)