Skip to content

Commit

Permalink
watcher: add testnet to logger product
Browse files Browse the repository at this point in the history
  • Loading branch information
panoel committed Dec 20, 2023
1 parent f2caa51 commit 96ecca7
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
2 changes: 2 additions & 0 deletions watcher/src/utils/environment.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ let loggingEnv: LoggingEnvironment | undefined = undefined;
export type LoggingEnvironment = {
logLevel: string;
logDir?: string;
network?: string;
};

export const getEnvironment = () => {
Expand All @@ -12,6 +13,7 @@ export const getEnvironment = () => {
loggingEnv = {
logLevel: process.env.LOG_LEVEL || 'info',
logDir: process.env.LOG_DIR,
network: process.env.NETWORK,
};
return loggingEnv;
}
Expand Down
4 changes: 2 additions & 2 deletions watcher/src/utils/logger.ts
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ export const getLogger = (source: string): WormholeLogger => {
};

const createBaseLogger = (): WormholeLogger => {
const { logLevel, logDir } = getEnvironment();
const { logLevel, logDir, network } = getEnvironment();
const logPath = !!logDir ? `${logDir}/watcher.${new Date().toISOString()}.log` : null;
let transport: winston.transport[] = [
logPath
Expand All @@ -60,7 +60,7 @@ const createBaseLogger = (): WormholeLogger => {
const GRAFANA_HOST = assertEnvironmentVariable('GRAFANA_HOST');
const GRAFANA_USERID = assertEnvironmentVariable('GRAFANA_USERID');
const GRAFANA_PASSWORD = assertEnvironmentVariable('GRAFANA_PASSWORD');
const MY_APP_NAME = 'wormhole-dashboard';
const MY_APP_NAME = network === '' ? 'wormhole-dashboard' : `wormhole-dashboard-${network}`;
const GRAFANA_BASICAUTH = GRAFANA_USERID + ':' + GRAFANA_PASSWORD;
transport.push(
new LokiTransport({
Expand Down

0 comments on commit 96ecca7

Please sign in to comment.