Skip to content

Commit 96ecca7

Browse files
committed
watcher: add testnet to logger product
1 parent f2caa51 commit 96ecca7

File tree

2 files changed

+4
-2
lines changed

2 files changed

+4
-2
lines changed

watcher/src/utils/environment.ts

+2
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ let loggingEnv: LoggingEnvironment | undefined = undefined;
33
export type LoggingEnvironment = {
44
logLevel: string;
55
logDir?: string;
6+
network?: string;
67
};
78

89
export const getEnvironment = () => {
@@ -12,6 +13,7 @@ export const getEnvironment = () => {
1213
loggingEnv = {
1314
logLevel: process.env.LOG_LEVEL || 'info',
1415
logDir: process.env.LOG_DIR,
16+
network: process.env.NETWORK,
1517
};
1618
return loggingEnv;
1719
}

watcher/src/utils/logger.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ export const getLogger = (source: string): WormholeLogger => {
4545
};
4646

4747
const createBaseLogger = (): WormholeLogger => {
48-
const { logLevel, logDir } = getEnvironment();
48+
const { logLevel, logDir, network } = getEnvironment();
4949
const logPath = !!logDir ? `${logDir}/watcher.${new Date().toISOString()}.log` : null;
5050
let transport: winston.transport[] = [
5151
logPath
@@ -60,7 +60,7 @@ const createBaseLogger = (): WormholeLogger => {
6060
const GRAFANA_HOST = assertEnvironmentVariable('GRAFANA_HOST');
6161
const GRAFANA_USERID = assertEnvironmentVariable('GRAFANA_USERID');
6262
const GRAFANA_PASSWORD = assertEnvironmentVariable('GRAFANA_PASSWORD');
63-
const MY_APP_NAME = 'wormhole-dashboard';
63+
const MY_APP_NAME = network === '' ? 'wormhole-dashboard' : `wormhole-dashboard-${network}`;
6464
const GRAFANA_BASICAUTH = GRAFANA_USERID + ':' + GRAFANA_PASSWORD;
6565
transport.push(
6666
new LokiTransport({

0 commit comments

Comments
 (0)