How to use stdout-stream - 3 common examples

To help you get started, we’ve selected a few stdout-stream 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 zmts / supra-api-nodejs / main.js View on Github external
}).catch(error => {
    stdout.write(chalk.blue(error.stack))
    logger.error('Database fails to initialize...', error)
    process.exit(1)
  })
github zmts / supra-api-nodejs / middlewares / errorMiddleware / DevErrorMiddleware.js View on Github external
...error,
          code: error.code || errorCodes.SERVER.code,
          status: error.status || errorCodes.SERVER.status,
          message: error.message || error,
          stack: ![400, 401, 403, 422].includes(error.status) ? stackTrace.parse(error) : false,
          src: `${process.env.NODE_ENV}:err:middleware`
        })

        logger.error(errorRes.message, error, { ...errorRes, req: error.req, meta: error.meta })
        res.status(errorRes.status).json(errorRes)
      }

      if (error.stack) {
        stdout.write(chalk.red('--------------- ERROR STACK BEGIN --------------\n'))
        stdout.write(`${new Date()} env:dev/regular error\n`)
        stdout.write(chalk.blue(error.stack))
        stdout.write(chalk.red('\n---------------- ERROR STACK END ---------------\n\n'))
      }
    }
  }
github zmts / supra-api-nodejs / middlewares / errorMiddleware / DevErrorMiddleware.js View on Github external
} else {
        const errorRes = new ErrorResponse({
          ...error,
          code: error.code || errorCodes.SERVER.code,
          status: error.status || errorCodes.SERVER.status,
          message: error.message || error,
          stack: ![400, 401, 403, 422].includes(error.status) ? stackTrace.parse(error) : false,
          src: `${process.env.NODE_ENV}:err:middleware`
        })

        logger.error(errorRes.message, error, { ...errorRes, req: error.req, meta: error.meta })
        res.status(errorRes.status).json(errorRes)
      }

      if (error.stack) {
        stdout.write(chalk.red('--------------- ERROR STACK BEGIN --------------\n'))
        stdout.write(`${new Date()} env:dev/regular error\n`)
        stdout.write(chalk.blue(error.stack))
        stdout.write(chalk.red('\n---------------- ERROR STACK END ---------------\n\n'))
      }
    }
  }

stdout-stream

Non-blocking stdout stream

MIT
Latest version published 2 years ago

Package Health Score

65 / 100
Full package analysis

Popular stdout-stream functions