Skip to content

Commit 994ad53

Browse files
committed
rename to parseProperties
1 parent 7dee9bb commit 994ad53

2 files changed

Lines changed: 8 additions & 8 deletions

File tree

azure/activity_logs_monitoring/index.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -383,15 +383,15 @@ class EventhubLogHandler {
383383
this.records.push(originalRecord);
384384
}
385385
} else {
386-
this.records.push(this.formatProperties(originalRecord));
386+
this.records.push(this.parseProperties(originalRecord));
387387
}
388388
} else {
389389
record = this.addTagsToStringLog(record);
390390
this.records.push(record);
391391
}
392392
}
393393

394-
formatProperties(record) {
394+
parseProperties(record) {
395395
// Check if properties field is a malformed JSON String
396396
if (Object.hasOwn(record, 'properties') && (typeof record.properties === 'string') && (record.properties.includes("':'"))) {
397397
try {

azure/test/activity_logs_monitoring.test.js

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -818,15 +818,15 @@ describe('Log Splitting', function() {
818818
});
819819
});
820820
});
821-
describe('EventhubLogHandler Fix Properties Json String', function() {
821+
describe('EventhubLogHandler Parse Properties', function() {
822822

823823
beforeEach(function() {
824824
this.forwarder = setUp();
825825
});
826826

827827
it('parses properties string with single quotes into object', function() {
828828
const record = { properties: "{'key':'value'}" };
829-
const result = this.forwarder.fixPropertiesJsonString(record);
829+
const result = this.forwarder.parseProperties(record);
830830

831831
const expectedProperties = { properties: { key: "value" } };
832832

@@ -842,7 +842,7 @@ describe('EventhubLogHandler Fix Properties Json String', function() {
842842

843843
it('parses object that doesnt have properties', function() {
844844
const record = { hostname: "server_name", subObject: { key:"value"} };
845-
const result = this.forwarder.fixPropertiesJsonString(record);
845+
const result = this.forwarder.parseProperties(record);
846846

847847
assert.deepEqual(
848848
record,
@@ -856,7 +856,7 @@ describe('EventhubLogHandler Fix Properties Json String', function() {
856856

857857
it('parses properties string with nested objects', function() {
858858
const record = { properties: "{'key':'value','subObj':{ 'subKey' : 'subValue' }}" };
859-
const result = this.forwarder.fixPropertiesJsonString(record);
859+
const result = this.forwarder.parseProperties(record);
860860

861861
const expectedProperties = { properties: { key: "value", subObj: { subKey: "subValue"} } };
862862

@@ -872,7 +872,7 @@ describe('EventhubLogHandler Fix Properties Json String', function() {
872872

873873
it("leaves properties string unchanged when it doesn't match the malformed pattern", function() {
874874
const record = { properties: 'some plain string without colons' };
875-
const result = this.forwarder.fixPropertiesJsonString(record);
875+
const result = this.forwarder.parseProperties(record);
876876

877877
assert.deepEqual(
878878
record,
@@ -887,7 +887,7 @@ describe('EventhubLogHandler Fix Properties Json String', function() {
887887
it('logs an error and returns original record when replacement results in invalid JSON', function() {
888888
// includes the "':'" marker so the function attempts replacement, but JSON remains invalid
889889
const badRecord = { properties: "Look i know i shouldn't but, i will do this ':' " };
890-
const result = this.forwarder.fixPropertiesJsonString(badRecord);
890+
const result = this.forwarder.parseProperties(badRecord);
891891

892892
assert.deepEqual(
893893
badRecord,

0 commit comments

Comments
 (0)