1234567891011121314151617181920212223242526272829 |
- 'use strict';
- const format = require('./format');
- const { MESSAGE } = require('triple-beam');
- const jsonStringify = require('safe-stable-stringify');
- module.exports = format(info => {
- const logstash = {};
- if (info.message) {
- logstash['@message'] = info.message;
- delete info.message;
- }
- if (info.timestamp) {
- logstash['@timestamp'] = info.timestamp;
- delete info.timestamp;
- }
- logstash['@fields'] = info;
- info[MESSAGE] = jsonStringify(logstash);
- return info;
- });
|