Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

cf-nodejs-logging-support

Package Overview
Dependencies
Maintainers
6
Versions
100
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

cf-nodejs-logging-support - npm Package Compare versions

Comparing version 7.4.0-beta.3 to 7.4.0-beta.4

1

build/main/lib/logger/record.d.ts

@@ -17,2 +17,3 @@ import { Level } from "./level";

errorMessage?: string;
customFieldNames: string[];
constructor(type: RecordType, level: Level);

@@ -19,0 +20,0 @@ }

@@ -15,2 +15,3 @@ "use strict";

this.level = level;
this.customFieldNames = new Array();
}

@@ -17,0 +18,0 @@ }

@@ -106,2 +106,3 @@ "use strict";

}
record.metadata.customFieldNames.push(key);
});

@@ -108,0 +109,0 @@ //writes custom fields in the correct order and correlates i to the place in registeredCustomFields

@@ -6,5 +6,14 @@ import { LoggerProvider } from '@opentelemetry/api-logs';

private logger;
private includeFieldsAsAttributes;
constructor(loggerProvider?: LoggerProvider);
setIncludeFieldsAsAttributes(includeFieldsAsAttributes: FieldInclusionMode): void;
writeRecord(record: Record): void;
private mapLevelToSeverityNumber;
private populateExceptionAttributes;
private populateAdditionalAttributes;
}
export declare enum FieldInclusionMode {
AllFields = "all",
CustomFieldsOnly = "custom-fields",
None = "none"
}
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.OpenTelemetryLogsOutputPlugin = void 0;
exports.FieldInclusionMode = exports.OpenTelemetryLogsOutputPlugin = void 0;
const api_logs_1 = require("@opentelemetry/api-logs");

@@ -15,3 +15,7 @@ const record_1 = require("../logger/record");

}
this.includeFieldsAsAttributes = FieldInclusionMode.CustomFieldsOnly;
}
setIncludeFieldsAsAttributes(includeFieldsAsAttributes) {
this.includeFieldsAsAttributes = includeFieldsAsAttributes;
}
writeRecord(record) {

@@ -22,11 +26,4 @@ if (record.metadata.type == record_1.RecordType.Request) {

let attributes = {};
if (record.metadata.errorName) {
attributes["exception.type"] = record.metadata.errorName;
}
if (record.metadata.errorMessage) {
attributes["exception.message"] = record.metadata.errorMessage;
}
if (record.metadata.rawStacktrace) {
attributes["exception.stacktrace"] = record.metadata.rawStacktrace;
}
this.populateExceptionAttributes(record, attributes);
this.populateAdditionalAttributes(record, attributes);
let severityNumber = this.mapLevelToSeverityNumber(record.metadata.level);

@@ -56,4 +53,40 @@ this.logger.emit({

}
populateExceptionAttributes(record, attributes) {
if (record.metadata.errorName) {
attributes["exception.type"] = record.metadata.errorName;
}
if (record.metadata.errorMessage) {
attributes["exception.message"] = record.metadata.errorMessage;
}
if (record.metadata.rawStacktrace) {
attributes["exception.stacktrace"] = record.metadata.rawStacktrace;
}
}
populateAdditionalAttributes(record, attributes) {
switch (this.includeFieldsAsAttributes) {
case FieldInclusionMode.AllFields:
for (let key in record.payload) {
attributes[key] = record.payload[key];
}
break;
case FieldInclusionMode.CustomFieldsOnly:
for (let key of record.metadata.customFieldNames) {
if (record.payload[key] !== undefined) {
attributes[key] = record.payload[key];
}
}
break;
case FieldInclusionMode.None:
default:
return;
}
}
}
exports.OpenTelemetryLogsOutputPlugin = OpenTelemetryLogsOutputPlugin;
var FieldInclusionMode;
(function (FieldInclusionMode) {
FieldInclusionMode["AllFields"] = "all";
FieldInclusionMode["CustomFieldsOnly"] = "custom-fields";
FieldInclusionMode["None"] = "none";
})(FieldInclusionMode || (exports.FieldInclusionMode = FieldInclusionMode = {}));
//# sourceMappingURL=otelOutput.js.map

2

package.json
{
"name": "cf-nodejs-logging-support",
"version": "7.4.0-beta.3",
"version": "7.4.0-beta.4",
"description": "Logging tool for Cloud Foundry",

@@ -5,0 +5,0 @@ "keywords": [

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

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc