Open mikemccawley opened 7 years ago
Provided additional example of how you can set a custom Cloudant log record format when setting up your logger. Added this to the README.
function CustomLogRecord(logRecord) {
this.timestamp = logRecord.time;
this.severity = logRecord.level;
this.hostname = logRecord.hostname;
this.appName = logRecord.name;
this.pid = logRecord.pid;
this.field1 = logRecord.field1;
this.field2 = logRecord.field2;
}
const logger = require('wis-logger')({
appName: 'logger-cloudant',
level: 'DEBUG',
console: true,
cloudant: true,
cloudantUrl: 'https://account.cloudant.com/logs',
cloudantUsername: 'username',
cloudantPassword: 'password',
cloudantLogDocument: CustomLogRecord,
cloudantLogHistory: true,
});
logger.debug({ field1: "field1 value", field2: "field2 value" });
users should be able to rename or add fields in their cloudant log database records. For example, pid could be component id and might want an "additional information" field as well.