How to use the xdl.ProjectUtils.attachLoggerStream function in xdl

To help you get started, we’ve selected a few xdl 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 / DeviceLogsStream.js View on Github external
_attachLoggerStream() {
    ProjectUtils.attachLoggerStream(this._projectRoot, {
      stream: {
        write: chunk => {
          if (chunk.tag !== 'device') {
            return;
          } else if (this._getCurrentOpenProjectId() !== this._projectId) {
            // TODO: We should be confident that we are properly unsubscribing
            // from the stream rather than doing a defensive check like this.
            return;
          }

          this._handleDeviceLogs(chunk);
        },
      },
      type: 'raw',
    });
  }
github NervJS / taro / packages / taro-rn-runner / src / util / packager.js View on Github external
newLogChunks.forEach(chunk => {
          if (chunk.msg === 'Restarted watchman.') {
            progressBar.tick(100 - progressBar.curr)
            log.setBundleProgressBar(null)
            progressBar = null
            log.withTimestamp(chalk.red('Failed building JavaScript bundle'))
          }
        })
      }

      newLogChunks.map(handleLogChunk)
    }
  })

  // Subscribe to device updates separately from packager/server updates
  ProjectUtils.attachLoggerStream(projectDir, {
    stream: {
      write: chunk => {
        if (chunk.tag === 'device') {
          handleLogChunk(chunk)
        }
      }
    },
    type: 'raw'
  })

  installExitHooks(projectDir, isInteractive)
  log.withTimestamp('Starting packager...')

  Project.startAsync(projectDir, options).then(
    () => {},
    reason => {
github expo / exp / src / exp.js View on Github external
startTime}ms.`
              )
            );
          }
        }
      },
      updateLogs: updater => {
        let newLogChunks = updater([]);
        newLogChunks.forEach(newLogChunk => {
          logWithLevel(newLogChunk);
        });
      },
    });

    // needed for validation logging to function
    ProjectUtils.attachLoggerStream(projectDir, {
      stream: {
        write: chunk => {
          if (chunk.tag === 'device') {
            logWithLevel(chunk);
          }
        },
      },
      type: 'raw',
    });

    // the existing CLI modules only pass one argument to this function, so skipProjectValidation
    // will be undefined in most cases. we can explicitly pass a truthy value here to avoid validation (eg for init)
    if (!skipProjectValidation) {
      log('Making sure project is set up correctly...');
      simpleSpinner.start();
      // validate that this is a good projectDir before we try anything else
github expo / exp / src / exp.js View on Github external
}
        }
      },
      updateLogs: updater => {
        let newLogChunks = updater([]);
        newLogChunks.forEach(newLogChunk => {
          if (newLogChunk.issueId && newLogChunk.issueCleared) {
            return;
          }
          logWithLevel(newLogChunk);
        });
      },
    });

    // needed for validation logging to function
    ProjectUtils.attachLoggerStream(projectDir, {
      stream: {
        write: chunk => {
          if (chunk.tag === 'device') {
            logWithLevel(chunk);
          }
        },
      },
      type: 'raw',
    });

    // The existing CLI modules only pass one argument to this function, so skipProjectValidation
    // will be undefined in most cases. we can explicitly pass a truthy value here to avoid
    // validation (eg for init)
    //
    // If the packager/manifest server is running and healthy, there is no need
    // to rerun Doctor because the directory was already checked previously
github react-community / create-react-native-app / react-native-scripts / src / util / packager.js View on Github external
newLogChunks.forEach(chunk => {
          if (chunk.msg === 'Restarted watchman.') {
            progressBar.tick(100 - progressBar.curr);
            log.setBundleProgressBar(null);
            progressBar = null;
            log.withTimestamp(chalk.red('Failed building JavaScript bundle'));
          }
        });
      }

      newLogChunks.map(handleLogChunk);
    },
  });

  // Subscribe to device updates separately from packager/server updates
  ProjectUtils.attachLoggerStream(projectDir, {
    stream: {
      write: chunk => {
        if (chunk.tag === 'device') {
          handleLogChunk(chunk);
        }
      },
    },
    type: 'raw',
  });

  installExitHooks(projectDir, isInteractive);
  log.withTimestamp('Starting packager...');

  Project.startAsync(projectDir, options).then(
    () => {},
    reason => {
github expo / xde / src / ui / App.js View on Github external
_startProjectAsync = async (projectRoot) => {
    if (this.state.projectRoot) {
      return false;
    }

    if (!projectRoot) {
      throw new Error("Could not open project: empty root.");
    }

    let projectSettings = await ProjectSettings.readAsync(projectRoot);
    let xdeProjectId = this._currentOpenProjectXDEId;

    ProjectUtils.attachLoggerStream(projectRoot, {
      stream: {
        write: (chunk) => {
          if (this._currentOpenProjectXDEId !== xdeProjectId) {
            return;
          }

          if (chunk.tag === 'device') {
            this._handleDeviceLogs(chunk);
          } else {
            this._appendLogChunk(chunk);
          }
        },
      },
      type: 'raw',
    });