@join-com/grpc
Advanced tools
Comparing version 3.6.0-alpha.2 to 3.6.0-alpha.3
@@ -110,4 +110,5 @@ "use strict"; | ||
} | ||
// eslint-disable-next-line no-console | ||
console.log(process.env); | ||
if (process.env['HOSTNAME']) { | ||
preparedMetadata.set('client', process.env['HOSTNAME']); | ||
} | ||
if (metadata) { | ||
@@ -114,0 +115,0 @@ for (const [key, value] of Object.entries(metadata)) { |
@@ -28,2 +28,3 @@ import * as grpc from '@grpc/grpc-js'; | ||
private reformatError; | ||
private getMetadataToLog; | ||
private handleError; | ||
@@ -30,0 +31,0 @@ private mapServerErrorLogSeverity; |
@@ -134,3 +134,3 @@ "use strict"; | ||
const response = !methodDefinition.responseStream ? result : 'STREAM'; | ||
const metadata = call.metadata.getMap(); | ||
const metadata = this.getMetadataToLog(call.metadata); | ||
if (!(result instanceof Error)) { | ||
@@ -154,2 +154,13 @@ this.logger.info(`GRPC Service ${methodDefinition.path}`, { request, response, latency, metadata }); | ||
} | ||
getMetadataToLog(metadata) { | ||
const metadataMap = metadata.getMap(); | ||
const metadataToLog = {}; | ||
if (metadataMap['consistency']) { | ||
metadataToLog['consistency'] = metadataMap['consistency'].toString(); | ||
} | ||
if (metadataMap['client']) { | ||
metadataToLog['client'] = metadataMap['client'].toString(); | ||
} | ||
return metadataToLog; | ||
} | ||
handleError(error, callback) { | ||
@@ -156,0 +167,0 @@ const code = this.getGrpcStatusCode(error); |
{ | ||
"name": "@join-com/grpc", | ||
"version": "3.6.0-alpha.2", | ||
"version": "3.6.0-alpha.3", | ||
"description": "gRPC library", | ||
@@ -5,0 +5,0 @@ "author": "JOIN Solutions", |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
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
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
84046
903
3