title: How to catch errors on Winston Http Transport
body: <p>I'm creating a logging framework using winston. Basically using built in winston http transport. My question is, how should I catch any http exceptions that might have occurred while making http post request due to invalid host/path/auth. Below is my code structure-</p>
  
  <pre><code>    const { createLogger, format, transports } = require('winston');
  const { combine, timestamp, label, printf } = format;
  
  const transportOptions = {
    host: 'host',
    port: 'port',
    path: '/',
    auth: '',
  };
  
  const myFormat = printf(debug =&gt; {
      var msg = {
        timestamp: debug.timestamp,
        label: debug.label,
        level: debug.level,
        message: debug.message,
      };
      return JSON.stringify(msg);
    });
  
    const logger = createLogger({
      level: 'debug',
      format: combine(label({ label: 'label' }), timestamp(), myFormat),
      transports: [
        new transports.Console(),
        new transports.Http(transportOptions),
      ],
      json: false,
    });
  
  logger.info('Test');
  </code></pre>
  
  <p>If I provide wrong value in <code>transportOptions</code> it just does nothing. I want my framework through some sort of exception so that I would know when any error/exception occurs. Can anyone please give me any suggestion?</p>