stream.prod.js 586 B

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