mirror of
https://github.com/misskey-dev/SyslogPro.git
synced 2025-04-28 18:27:27 +09:00
allow to set multple values for a field of structured data
This commit is contained in:
parent
094874fc29
commit
83c1ffa47e
8
index.ts
8
index.ts
@ -1452,9 +1452,11 @@ export class RFC5424 extends RFC {
|
|||||||
return '[' + [
|
return '[' + [
|
||||||
sdId,
|
sdId,
|
||||||
...Object.entries(sdParam)
|
...Object.entries(sdParam)
|
||||||
.map(([name, value]) =>
|
.reduce((array, [name, value]) => [
|
||||||
`${name}="${RFC5424.escapeParamValue(value)}"`
|
...array,
|
||||||
),
|
...(Array.isArray(value) ? value : [value])
|
||||||
|
.map((v) => `${name}="${RFC5424.escapeParamValue(v)}"`),
|
||||||
|
], []),
|
||||||
].join(' ') + ']';
|
].join(' ') + ']';
|
||||||
}).join('');
|
}).join('');
|
||||||
}
|
}
|
||||||
|
@ -456,7 +456,7 @@ describe('RFC5424 Class Tests', () => {
|
|||||||
structuredData: {
|
structuredData: {
|
||||||
"hi@32473": {
|
"hi@32473": {
|
||||||
foo: 1,
|
foo: 1,
|
||||||
bar: 2
|
bar: [2, 3]
|
||||||
},
|
},
|
||||||
escape: {
|
escape: {
|
||||||
quoteCharacter: '"',
|
quoteCharacter: '"',
|
||||||
@ -465,7 +465,7 @@ describe('RFC5424 Class Tests', () => {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
expect(result).toMatch(/^<190>1 \S+ \S+ - - - \[hi@32473 foo="1" bar="2"\]\[escape quoteCharacter="\\"" backslack="\\\\" closingBrace="\\]"\] BOMhello\n$/);
|
expect(result).toMatch(/^<190>1 \S+ \S+ - - - \[hi@32473 foo="1" bar="2" bar="3"\]\[escape quoteCharacter="\\"" backslack="\\\\" closingBrace="\\]"\] BOMhello\n$/);
|
||||||
});
|
});
|
||||||
test('RFC5424 BuildMessage with octet-counting', () => {
|
test('RFC5424 BuildMessage with octet-counting', () => {
|
||||||
const rfc5424 = new SyslogPro.RFC5424({
|
const rfc5424 = new SyslogPro.RFC5424({
|
||||||
|
Loading…
x
Reference in New Issue
Block a user