patternfly-elements icon indicating copy to clipboard operation
patternfly-elements copied to clipboard

[feat] Add error logging to pfelement

Open castastrophe opened this issue 5 years ago • 1 comments

Something like this but for errors 🙃

  /**
   * A console warning wrapper which formats your output with useful debugging information.
   *
   * @example PFElement.warn("Hello");
   */
  static warn(...msgs) {
    console.warn(...msgs);
  }

  /**
   * Local warning wrapper that outputs the tag name as a prefix automatically.
   * For use inside a component's function.
   * @example this.warn("Hello");
   */
  warn(...msgs) {
    PFElement.warn(`[${this.tag}${this.id ? `#${this.id}` : ``}]`, ...msgs);
  }

castastrophe avatar Jul 28 '21 13:07 castastrophe

we've migrated from PFElement to LitElement, but maintained all the logging logic in https://github.com/patternfly/patternfly-elements/blob/main/core/pfe-core/controllers/logger.ts

We have an error method there, but it actually throws an error. I did not find any references in the code to that method. I'd be very happy to remove the throw new Error statement and just log whichever values the method receives at error level.

bennypowers avatar Feb 24 '22 12:02 bennypowers