[logging/json] use merge from kbn/std (#86330)
Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>
This commit is contained in:
parent
54390f02f9
commit
92b2b60ad5
|
@ -18,7 +18,7 @@
|
|||
*/
|
||||
|
||||
import moment from 'moment-timezone';
|
||||
import { merge } from 'lodash';
|
||||
import { merge } from '@kbn/std';
|
||||
import { schema } from '@kbn/config-schema';
|
||||
import { LogRecord, Layout } from '@kbn/logging';
|
||||
|
||||
|
@ -53,9 +53,7 @@ export class JsonLayout implements Layout {
|
|||
}
|
||||
|
||||
public format(record: LogRecord): string {
|
||||
return JSON.stringify(
|
||||
merge(
|
||||
{
|
||||
const log = {
|
||||
'@timestamp': moment(record.timestamp).format('YYYY-MM-DDTHH:mm:ss.SSSZ'),
|
||||
message: record.message,
|
||||
error: JsonLayout.errorToSerializableObject(record.error),
|
||||
|
@ -66,9 +64,8 @@ export class JsonLayout implements Layout {
|
|||
process: {
|
||||
pid: record.pid,
|
||||
},
|
||||
},
|
||||
record.meta
|
||||
)
|
||||
);
|
||||
};
|
||||
const output = record.meta ? merge(log, record.meta) : log;
|
||||
return JSON.stringify(output);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue