Jump To …
winston/common.html winston/config/cli-config.html winston/config/npm-config.html winston/config/syslog-config.html winston/config.html winston/exception.html winston/logger.html winston/transports/console.html winston/transports/couchdb.html winston/transports/file.html winston/transports/loggly.html winston/transports/transport.html winston/transports/webhook.html winston/transports.html winston.html

# transports.js |
--- | ---
¶ |
    /*
     * transports.js: Set of all transports Winston knows about
     *
     * (C) 2010 Charlie Robbins
     * MIT LICENCE
     *
     */

    var fs = require('fs'),
        path = require('path');

    var transports = exports;

    function capitalize (str) {
      return str && str[0].toUpperCase() + str.slice(1);
    };
¶ Setup all transports as lazy-loaded getters. |
    fs.readdirSync(path.join(__dirname, 'transports')).forEach(function (file) {
      var transport = file.replace('.js', ''),
          name  = capitalize(transport);

      if (transport === 'transport') {
        return;
      }

      transports.__defineGetter__(name, function () {
        return require('./transports/' + transport)[name];
      });
    });