@gravity-ui/nodekit
Advanced tools
Comparing version 0.6.0 to 0.7.0
import pino from 'pino'; | ||
/** | ||
* workaround to provide IntelliSense hints https://stackoverflow.com/a/61048124 | ||
*/ | ||
export type LoggingLevel = pino.LevelWithSilent | (string & {}); | ||
interface InitLoggerOptions { | ||
@@ -6,19 +10,5 @@ appName: string; | ||
destination?: pino.DestinationStream; | ||
level?: LoggingLevel; | ||
} | ||
export declare function initLogger({ appName, devMode, destination }: InitLoggerOptions): import("pino").Logger<{ | ||
name: string; | ||
safe: boolean; | ||
leve: string; | ||
serializers: { | ||
error: typeof import("pino-std-serializers").err; | ||
}; | ||
transport: { | ||
target: string; | ||
options: { | ||
colorize: boolean; | ||
ignore: string; | ||
translateTime: string; | ||
}; | ||
} | undefined; | ||
}>; | ||
export declare function initLogger({ appName, devMode, destination, level }: InitLoggerOptions): import("pino").Logger<pino.LoggerOptions>; | ||
export {}; |
@@ -8,3 +8,3 @@ "use strict"; | ||
const pino_1 = __importDefault(require("pino")); | ||
function initLogger({ appName, devMode, destination }) { | ||
function initLogger({ appName, devMode, destination, level = 'debug' }) { | ||
const transportConfig = devMode | ||
@@ -23,3 +23,3 @@ ? { | ||
safe: true, | ||
leve: 'debug', | ||
level, | ||
serializers: { | ||
@@ -26,0 +26,0 @@ error: pino_1.default.stdSerializers.err, |
@@ -59,2 +59,3 @@ "use strict"; | ||
appDevMode, | ||
appLoggingLevel: process.env.APP_LOGGING_LEVEL || fileConfig.appLoggingLevel, | ||
}); | ||
@@ -65,2 +66,3 @@ this.logger = (0, logging_1.initLogger)({ | ||
destination: this.config.appLoggingDestination, | ||
level: this.config.appLoggingLevel, | ||
}); | ||
@@ -83,2 +85,3 @@ const redactSensitiveQueryParams = (0, redact_sensitive_query_params_1.default)((_a = this.config.nkDefaultSensitiveQueryParams) === null || _a === void 0 ? void 0 : _a.concat(this.config.appSensitiveQueryParams || []), appDevMode); | ||
agentPort: this.config.appTracingAgentPort, | ||
collectorEndpoint: this.config.appTracingCollectorEndpoint, | ||
}, | ||
@@ -99,3 +102,11 @@ }, { | ||
this.ctx.stats = (0, clickhouse_1.prepareClickhouseClient)(this.ctx); | ||
this.addShutdownHandler(() => new Promise((resolve) => this.tracer.close(resolve))); | ||
this.addShutdownHandler(() => new Promise((resolve) => { | ||
// if tracing is disabled, initTracer returns object without close method | ||
if (typeof this.tracer.close === 'function') { | ||
this.tracer.close(resolve); | ||
} | ||
else { | ||
resolve(); | ||
} | ||
})); | ||
this.setupShutdownSignals(); | ||
@@ -102,0 +113,0 @@ } |
@@ -1,2 +0,3 @@ | ||
import { pino } from 'pino'; | ||
import type { pino } from 'pino'; | ||
import type { LoggingLevel } from './lib/logging'; | ||
export interface AppConfig { | ||
@@ -17,2 +18,3 @@ appName?: string; | ||
appLoggingDestination?: pino.DestinationStream; | ||
appLoggingLevel?: LoggingLevel; | ||
appTracingEnabled?: boolean; | ||
@@ -27,2 +29,3 @@ appTracingServiceName?: string; | ||
appTracingAgentPort?: number; | ||
appTracingCollectorEndpoint?: string; | ||
appTelemetryChHost?: string; | ||
@@ -29,0 +32,0 @@ appTelemetryChPort?: string; |
{ | ||
"name": "@gravity-ui/nodekit", | ||
"version": "0.6.0", | ||
"version": "0.7.0", | ||
"description": "Simple toolkit for your Node.js apps and scripts", | ||
@@ -5,0 +5,0 @@ "license": "MIT", |
Environment variable access
Supply chain riskPackage accesses environment variables, which may be a sign of credential stuffing or data theft.
Found 1 instance in 1 package
48670
1131
12