const logger = new (winston.Logger)({
transports : [
new winston.transports.PostgreSQL({
connString : 'xxxxxxxxxxx',
schema : 'public',
//tableName : 'logEntry',
customSql:'INSERT INTO public."logEntry"(logLevel, msg, meta) VALUES ($1, $2, $3);',
})
];
});
Data is not inserted into the table and I get a warning in the console:
Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.
Can anyone tell me what's wrong with this code?
I created table using sequelize with timestamp enabled, Here inserting data manually means it won't add createdAt column, that causes issue. replacing customSql:'INSERT INTO public."logEntry"(logLevel, msg, meta) VALUES ($1, $2, $3);', with customSql: 'INSERT INTO public."logEntry"("logLevel", msg, meta,"createdAt") VALUES ($1, $2, $3,CURRENT_TIMESTAMP);', solved the issue. thank you