How to use the @parcel/logger.onLog function in @parcel/logger

To help you get started, we’ve selected a few @parcel/logger 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 parcel-bundler / parcel / packages / core / workers / src / child.js View on Github external
constructor(ChildBackend: Class) {
    this.child = new ChildBackend(
      this.messageListener.bind(this),
      this.handleEnd.bind(this),
    );

    // Monitior all logging events inside this child process and forward to
    // the main process via the bus.
    this.loggerDisposable = Logger.onLog(event => {
      bus.emit('logEvent', event);
    });
  }
github parcel-bundler / parcel / packages / core / core / src / ReporterRunner.js View on Github external
constructor(opts: Opts) {
    this.config = opts.config;
    this.options = opts.options;
    this.pluginOptions = new PluginOptions(this.options);

    logger.onLog(event => this.report(event));

    // Convert any internal bundles back to their public equivalents as reporting
    // is public api
    bus.on('reporterEvent', event => {
      if (event.bundle == null) {
        this.report(event);
      } else {
        this.report({
          ...event,
          bundle: new NamedBundle(
            event.bundle,
            event.bundleGraph,
            this.options,
          ),
        });
      }