How to use the postal.diagnostics.length function in postal

To help you get started, we’ve selected a few postal examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github vincentbernat / dashkiosk / lib / bus.js View on Github external
'use strict';

var postal = require('postal'),
    _ = require('lodash'),
    config = require('./config'),
    logger = require('./logger');

if (config.get('environment') === 'development') {
  var diagnostics = require('postal.diagnostics'),
      Tap = (diagnostics.length === 1)?
        diagnostics(postal):
        diagnostics(_, postal),
      tap = new Tap({ name: 'winston',
                      serialize: function(envelope) {
                        var serialized = _.pick(envelope,
                                                [ 'channel', 'topic', 'timeStamp' ]);
                        serialized.data = _.mapValues(envelope.data || {}, function(val) {
                          if (typeof val === 'object') {
                            return '...';
                          }
                          return val;
                        });
                        return serialized;
                      },
                      writer: function(output) {
                        logger.debug('postal', output);

postal

Pub/Sub library providing wildcard subscriptions, complex message handling, etc. Works server and client-side.

MIT
Latest version published 3 years ago

Package Health Score

59 / 100
Full package analysis