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