stream.prod.js 504 B

1234567891011121314151617181920
  1. const isBrowser = typeof window !== 'undefined';
  2. let stream = undefined;
  3. // browser settings
  4. if (isBrowser) {
  5. const ConsoleFormattedStream = require('@browser-bunyan/console-formatted-stream').ConsoleFormattedStream;
  6. stream = new ConsoleFormattedStream();
  7. }
  8. // node settings
  9. else {
  10. const isFormat = !(process.env.FORMAT_NODE_LOG === 'false');
  11. if (isFormat) {
  12. const bunyanFormat = require('bunyan-format');
  13. stream = bunyanFormat({ outputMode: 'long' });
  14. }
  15. }
  16. module.exports = stream;