How to use non SMTP transport in log4js smtp appender?

How to use non SMTP transport in log4js smtp appender?

After a couple of hours of trial and error, I found out the solution. Here is the example log4js configuration with console and smtp appenders:

sendgridTransport = require('nodemailer-sendgrid-transport');

log4js.configure({
    appenders: [{
        type: 'console'
    }, {
        type: 'logLevelFilter',
        level: 'ERROR',
        appender: {
            type: 'smtp',
            recipients: 'admin@example.com',
            sender: 'system@example.com',
            sendInterval: 60,
            transport: sendgridTransport({
                auth: {
                    api_user: config.smtpUsername,
                    api_key: config.smtpPassword
                }
            })
        }
    }]
});