fix(log): procces.stdout/stderr are undefined in browsers (#4765)

This commit is contained in:
Rajaa.BARHTAOUI 2020-01-31 10:32:39 +01:00 committed by GitHub
parent 1ec6611410
commit bb19c55c3a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -3,7 +3,12 @@ import LEVELS, { NAMES } from '../levels'
const { DEBUG, ERROR, FATAL, INFO, WARN } = LEVELS
let formatLevel, formatNamespace
if (process.stdout.isTTY && process.stderr.isTTY) {
if (
process.stdout !== undefined &&
process.stdout.isTTY &&
process.stderr !== undefined &&
process.stderr.isTTY
) {
const ansi = (style, str) => `\x1b[${style}m${str}\x1b[0m`
const LEVEL_STYLES = {