How to use the @expo/bunyan.INFO 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 / xde / src / ui / ConsoleLog.js View on Github external
_getLogPreStyles = (log, index) => {
    let message = log.msg;

    // Get log style
    let logStyle = InlineStyles.logDefault;
    if (LOG_LEVEL_TO_STYLE[log.level]) {
      logStyle = LOG_LEVEL_TO_STYLE[log.level];
    }

    // Lower priority of packager logs
    if (log.tag === 'metro' && log.level === bunyan.INFO) {
      logStyle = InlineStyles.logDebug;
    }

    // Expo logs can be "quiet" which formats them the same as packager logs
    if (log.name === 'expo' && log.level === bunyan.INFO && log.quiet) {
      logStyle = InlineStyles.logDebug;
    }

    // A big chunk of json is logged right when an app starts. Lower the priority.
    if (this._isStartupMessage(log)) {
      logStyle = InlineStyles.logDebug;
    }

    let otherStyles = {};
    if (message.includes('Project opened!')) {
      otherStyles = InlineStyles.bigLog;
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 / expo-cli / packages / xdl / src / Logger.ts View on Github external
closeOnExit: false,
            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 / xde / src / ui / MainScreen.js View on Github external
this.setState(state => {
        let connectedDevices = state.connectedDevices;
        let focusedConnectedDeviceId = state.focusedConnectedDeviceId;

        for (let i = 0; i < this._deviceLogsToAdd.length; i++) {
          let chunk = this._deviceLogsToAdd[i];
          if (!connectedDevices[chunk.deviceId]) {
            let name = this._getDeviceName(chunk.deviceId, chunk.deviceName);
            if (!focusedConnectedDeviceId) {
              focusedConnectedDeviceId = chunk.deviceId;
            }
            connectedDevices[chunk.deviceId] = {
              name,
              logs: [
                {
                  level: bunyan.INFO,
                  msg: `Streaming logs from ${name}...`,
                  time: new Date(),
                },
              ],
            };
          }

          connectedDevices[chunk.deviceId].logs = connectedDevices[chunk.deviceId].logs.concat([
            chunk,
          ]);
        }
        this._deviceLogsToAdd = [];

        return {
          focusedConnectedDeviceId,
          connectedDevices,
github expo / expo-cli / packages / expo-cli / src / exp.ts View on Github external
write: (chunk: any) => {
        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 / NotificationsTab.js View on Github external
'Error',
        StyleConstants.colorError
      );
      this._addLogsForArray(
        logs,
        notifications.warn,
        bunyan.WARN,
        'Warning',
        StyleConstants.colorWarning
      );
      this._addLogsForArray(logs, notifications.info, bunyan.INFO, 'Info');
    }

    if (logs.length === 0) {
      logs.push({
        level: bunyan.INFO,
        msg: 'No notifications right now!',
        leftMsg: '',
        hasVerticalPadding: true,
      });
    }

    return ;
  }
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);
      }
    };
github expo / xde / src / ui / MainScreen.js View on Github external
});
              return;
            case NotificationCode.STOP_LOADING:
              this.setState({
                isLoading: false,
              });
              return;
            case NotificationCode.DOWNLOAD:
              return;
          }

          let notificationOptions = {
            indefinite: !!chunk.indefinite,
          };

          if (chunk.level <= bunyan.INFO) {
            this._showNotification('info', chunk.msg, notificationOptions);
          } else {
            this._showNotification('warning', chunk.msg, notificationOptions);
          }
        },
      },
github expo / expo-cli / packages / expo-cli / src / exp.ts View on Github external
const logWithLevel = (chunk: LogRecord) => {
      if (!chunk.msg) {
        return;
      }
      if (chunk.level <= bunyan.INFO) {
        if (chunk.includesStack) {
          logStackTrace(chunk, log, log.nested);
        } else {
          logLines(chunk.msg, log);
        }
      } else if (chunk.level === bunyan.WARN) {
        if (chunk.includesStack) {
          logStackTrace(chunk, log.warn, log.nestedWarn);
        } else {
          logLines(chunk.msg, log.warn);
        }
      } else {
        if (chunk.includesStack) {
          logStackTrace(chunk, log.error, log.nestedError);
        } else {
          logLines(chunk.msg, log.error);
github expo / xde / src / ui / NotificationsTab.js View on Github external
if (notifications) {
      this._addLogsForArray(
        logs,
        notifications.error,
        bunyan.ERROR,
        'Error',
        StyleConstants.colorError
      );
      this._addLogsForArray(
        logs,
        notifications.warn,
        bunyan.WARN,
        'Warning',
        StyleConstants.colorWarning
      );
      this._addLogsForArray(logs, notifications.info, bunyan.INFO, 'Info');
    }

    if (logs.length === 0) {
      logs.push({
        level: bunyan.INFO,
        msg: 'No notifications right now!',
        leftMsg: '',
        hasVerticalPadding: true,
      });
    }

    return ;
  }

@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