Node.js: Winston: Can I add default meta data to all log messages

For Winston v2 (see comments)

There are now rewriters.

For example, the below will add a property app to every metadata going through this logger.

    logger.rewriters.push(function(level, msg, meta) {
      meta.app = 'myApp';
      return meta;
    });

You can also declare it when building the logger:

    new (winston.Logger)({
            level: config.log[file].level,
            rewriters: [
                (level, msg, meta) => {
                    meta.app = 'myApp';
                    return meta;
                }
            ],
            transports: [
                /*your transports*/
            ]
    });

For Winston v3:

const addAppNameFormat = winston.format(info => {
  info.appName = "My Program";
  return info;
});

const logger = winston.createLogger({
  format: winston.format.combine(
    addAppNameFormat(),
    winston.format.json()
  ),
transports: [new winston.transports.Console()]
});

logger.warn('Danger Will Robinson!');
// {"message":"Danger Will Robinson!","level":"warn","appName":"My Program"}

See: https://github.com/winstonjs/winston/blob/HEAD/UPGRADE-3.0.md#migrating-filters-and-rewriters-to-formats-in-winston3