From 1e275087526e0bdd399eb5ee89378b3efaf056a2 Mon Sep 17 00:00:00 2001 From: Naseem Date: Fri, 24 Jul 2020 01:59:27 -0400 Subject: [PATCH] fix: set default log level to INFO As per https://github.com/open-telemetry/opentelemetry-js/pull/856 Signed-off-by: Naseem --- packages/opentelemetry-core/src/common/ConsoleLogger.ts | 2 +- packages/opentelemetry-core/src/utils/environment.ts | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/packages/opentelemetry-core/src/common/ConsoleLogger.ts b/packages/opentelemetry-core/src/common/ConsoleLogger.ts index d1a0018340e..d0ee72eaffb 100644 --- a/packages/opentelemetry-core/src/common/ConsoleLogger.ts +++ b/packages/opentelemetry-core/src/common/ConsoleLogger.ts @@ -19,7 +19,7 @@ import { LogLevel } from './types'; import { getEnv } from '../platform'; export class ConsoleLogger implements Logger { - constructor(level: LogLevel = getEnv().OTEL_LOG_LEVEL || LogLevel.INFO) { + constructor(level: LogLevel = getEnv().OTEL_LOG_LEVEL) { if (level >= LogLevel.DEBUG) { this.debug = (...args) => { console.debug(...args); diff --git a/packages/opentelemetry-core/src/utils/environment.ts b/packages/opentelemetry-core/src/utils/environment.ts index 86679d293d1..85ddfc70faa 100644 --- a/packages/opentelemetry-core/src/utils/environment.ts +++ b/packages/opentelemetry-core/src/utils/environment.ts @@ -37,7 +37,7 @@ const ENVIRONMENT_NUMBERS: Partial[] = [ */ export const DEFAULT_ENVIRONMENT: Required = { OTEL_NO_PATCH_MODULES: '', - OTEL_LOG_LEVEL: LogLevel.ERROR, + OTEL_LOG_LEVEL: LogLevel.INFO, OTEL_SAMPLING_PROBABILITY: 1, }; @@ -85,7 +85,7 @@ export function parseEnvironment(values: ENVIRONMENT_MAP): ENVIRONMENT { const logLevelString = value.toUpperCase() as LogLevelString logLevel = LogLevel[logLevelString]; } - environment[key] = logLevel ?? LogLevel.ERROR; + environment[key] = logLevel || DEFAULT_ENVIRONMENT[key] break; default: