How to use the @expo/bunyan.WARN function in @expo/bunyan

To help you get started, we’ve selected a few @expo/bunyan 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 expo / expo-cli / dev / xdl / src / Logger.js View on Github external
write(rec) {
    if (rec.level < bunyan.INFO) {
      console.log(rec);
    } else if (rec.level < bunyan.WARN) {
      console.info(rec);
    } else if (rec.level < bunyan.ERROR) {
      console.warn(rec);
    } else {
      console.error(rec);
    }
  }
}
github expo / expo-cli / packages / xdl / src / Logger.ts View on Github external
write(record: any) {
    if (record.level < bunyan.INFO) {
      console.log(record);
    } else if (record.level < bunyan.WARN) {
      console.info(record);
    } else if (record.level < bunyan.ERROR) {
      console.warn(record);
    } else {
      console.error(record);
    }
  }
}
github expo / xde / src / ui / MainScreen.js View on Github external
{
        level: bunyan.INFO,
        msg: `Logs from devices will appear here`,
        time: this._startTime,
      },
    ];

    if (this.state.expoSdkStatus === Doctor.EXPO_SDK_NOT_INSTALLED) {
      logs.push({
        level: bunyan.WARN,
        msg: `Please run \`npm install --save expo\` and add \`import 'expo'\` to the top of your main file to see device logs.`,
        time: this._startTime,
      });
    } else if (this.state.expoSdkStatus === Doctor.EXPO_SDK_NOT_IMPORTED) {
      logs.push({
        level: bunyan.WARN,
        msg: `Add \`import 'expo'\` to the top of your main file to see device logs.`,
        time: this._startTime,
      });
    } else if (
      this.state.isProjectRunning &&
      !(this.state.expJson && Versions.gteSdkVersion(this.state.expJson, '7.0.0'))
    ) {
      logs.push({
        level: bunyan.WARN,
        msg: `To see device logs, make sure your project uses at least SDK 7.0.0 and has a valid exp.json.`,
        time: this._startTime,
      });
    }

    return logs;
  };
github react-community / create-react-native-app / react-native-scripts / src / util / packager.js View on Github external
const logWithLevel = chunk => {
  if (!chunk.msg) {
    return;
  }

  let colorFn = str => str;
  if (chunk.level === bunyan.WARN) {
    colorFn = chalk.yellow;
  } else if (chunk.level === bunyan.ERROR) {
    colorFn = chalk.red;
  }

  if (chunk.includesStack) {
    logStackTrace(chunk, log.withTimestamp, log, colorFn);
  } else {
    logLines(chunk.msg, log.withTimestamp, colorFn);
  }
};
github expo / exp / src / exp.js View on Github external
if (chunk.code) {
          switch (chunk.code) {
            case NotificationCode.START_LOADING:
              simpleSpinner.start();
              return;
            case NotificationCode.STOP_LOADING:
              simpleSpinner.stop();
              return;
            case NotificationCode.DOWNLOAD_CLI_PROGRESS:
              return;
          }
        }

        if (chunk.level === bunyan.INFO) {
          log(chunk.msg);
        } else if (chunk.level === bunyan.WARN) {
          log.warn(chunk.msg);
        } else if (chunk.level >= bunyan.ERROR) {
          log.error(chunk.msg);
        }
      },
    },
github expo / xde / src / ui / ConsoleLog.js View on Github external
logLeftMsg: {
    fontSize: StyleConstants.fontSizeSm,
    color: StyleConstants.colorSubtitle,
    width: 85,
    minWidth: 85,
  },
  loadingIndicator: {
    paddingLeft: StyleConstants.gutterLg,
    paddingTop: StyleConstants.gutterLg,
  },
};

const LOG_LEVEL_TO_STYLE = {
  [bunyan.DEBUG]: InlineStyles.logDebug,
  [bunyan.INFO]: InlineStyles.logDefault,
  [bunyan.WARN]: InlineStyles.logWarning,
  [bunyan.ERROR]: InlineStyles.logError,
};
github expo / expo-cli / packages / xdl / src / Logger.ts View on Github external
level: 'debug',
          },
        ]
      : [],
});

export type LogStream = bunyan.Stream;
export type Log = bunyan;

export default {
  child: (options: object) => logger.child(options),
  notifications: logger.child({ type: 'notifications' }),
  global: logger.child({ type: 'global' }),
  DEBUG: bunyan.DEBUG,
  INFO: bunyan.INFO,
  WARN: bunyan.WARN,
  ERROR: bunyan.ERROR,
};
github expo / expo-cli / dev / xdl / src / Logger.js View on Github external
{
            type: 'raw',
            stream: new ConsoleRawStream(),
            closeOnExit: false,
            level: 'debug',
          },
        ]
      : []),
  ],
});

logger.notifications = logger.child({ type: 'notifications' });
logger.global = logger.child({ type: 'global' });
logger.DEBUG = bunyan.DEBUG;
logger.INFO = bunyan.INFO;
logger.WARN = bunyan.WARN;
logger.ERROR = bunyan.ERROR;

export default logger;
github expo / expo-cli / packages / expo-cli / src / exp.ts View on Github external
if (chunk.code) {
          switch (chunk.code) {
            case NotificationCode.START_LOADING:
              simpleSpinner.start();
              return;
            case NotificationCode.STOP_LOADING:
              simpleSpinner.stop();
              return;
            case NotificationCode.DOWNLOAD_CLI_PROGRESS:
              return;
          }
        }

        if (chunk.level === bunyan.INFO) {
          log(chunk.msg);
        } else if (chunk.level === bunyan.WARN) {
          log.warn(chunk.msg);
        } else if (chunk.level >= bunyan.ERROR) {
          log.error(chunk.msg);
        }
      },
    },
github expo / exp / src / exp.js View on Github external
const logWithLevel = chunk => {
      if (!chunk.msg) {
        return;
      }
      if (chunk.level <= bunyan.INFO) {
        logLines(chunk.msg, log);
      } else if (chunk.level === bunyan.WARN) {
        logLines(chunk.msg, log.warn);
      } else {
        logLines(chunk.msg, log.error);
      }
    };

@expo/bunyan

a JSON logging library for node.js services

MIT
Latest version published 3 years ago

Package Health Score

61 / 100
Full package analysis