[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,22 +53,19 @@ export class JsonLayout implements Layout {
|
|||
}
|
||||
|
||||
public format(record: LogRecord): string {
|
||||
return JSON.stringify(
|
||||
merge(
|
||||
{
|
||||
'@timestamp': moment(record.timestamp).format('YYYY-MM-DDTHH:mm:ss.SSSZ'),
|
||||
message: record.message,
|
||||
error: JsonLayout.errorToSerializableObject(record.error),
|
||||
log: {
|
||||
level: record.level.id.toUpperCase(),
|
||||
logger: record.context,
|
||||
},
|
||||
process: {
|
||||
pid: record.pid,
|
||||
},
|
||||
},
|
||||
record.meta
|
||||
)
|
||||
);
|
||||
const log = {
|
||||
'@timestamp': moment(record.timestamp).format('YYYY-MM-DDTHH:mm:ss.SSSZ'),
|
||||
message: record.message,
|
||||
error: JsonLayout.errorToSerializableObject(record.error),
|
||||
log: {
|
||||
level: record.level.id.toUpperCase(),
|
||||
logger: record.context,
|
||||
},
|
||||
process: {
|
||||
pid: record.pid,
|
||||
},
|
||||
};
|
||||
const output = record.meta ? merge(log, record.meta) : log;
|
||||
return JSON.stringify(output);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue