Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Something wrong on Logger service #80

Closed
sciotta opened this issue May 23, 2017 · 3 comments
Closed

Something wrong on Logger service #80

sciotta opened this issue May 23, 2017 · 3 comments
Labels

Comments

@sciotta
Copy link

sciotta commented May 23, 2017

I just installed using yeoman command and started using npm start. But in browser nothing shows and I received this error:

ERROR TypeError: Illegal invocation at Logger.webpackJsonp.58.Logger.log (http://localhost:4200/main.bundle.js:1806:18) at Logger.webpackJsonp.58.Logger.debug (http://localhost:4200/main.bundle.js:1767:14) at AppComponent.webpackJsonp.287.AppComponent.ngOnInit (http://localhost:4200/main.bundle.js:846:13) at checkAndUpdateDirectiveInline (http://localhost:4200/vendor.bundle.js:11025:19) at checkAndUpdateNodeInline (http://localhost:4200/vendor.bundle.js:12448:17) at checkAndUpdateNode (http://localhost:4200/vendor.bundle.js:12387:16) at debugCheckAndUpdateNode (http://localhost:4200/vendor.bundle.js:13090:59) at debugCheckDirectivesFn (http://localhost:4200/vendor.bundle.js:13031:13) at Object.eval [as updateDirectives] (ng:///AppModule/AppComponent_Host.ngfactory.js:17:5) at Object.debugUpdateDirectives [as updateDirectives] (http://localhost:4200/vendor.bundle.js:13016:21)

Anybody with the same issue?

@sciotta sciotta changed the title Something wrong on Logger srevice Something wrong on Logger service May 23, 2017
@sinedied
Copy link
Member

Which browser/version are you using?

In app/core/logger.service.ts, try replacing:

 private log(func: Function, level: LogLevel, objects: any[]) {
    if (level <= Logger.level) {
      const log = this.source ? ['[' + this.source + ']'].concat(objects) : objects;
      func.apply(func, log);
      Logger.outputs.forEach((output) => output.apply(output, [this.source, level].concat(objects)));
    }
  }

with

  private log(func: Function, level: LogLevel, objects: any[]) {
    if (level <= Logger.level) {
      const log = this.source ? ['[' + this.source + ']'].concat(objects) : objects;
      func.apply(console, log);
      Logger.outputs.forEach((output) => output.apply(output, [this.source, level].concat(objects)));
    }
  }

Tell me if it solves your issue.

Seems like some versions of Firefox have this issue,

@sinedied sinedied added the bug label May 24, 2017
@sciotta
Copy link
Author

sciotta commented May 28, 2017

@sinedied sorry about the time gap! I tried replace like you said before and everything works OK!

I don't know if is a browser issue because I tested on Firefox and Chrome (last version) and occours the same result. I'm using node 6.9.1 and Ubuntu. When I test without change anything on my mac i haven't problems.

Can it be a problem with some dependence?

@sinedied
Copy link
Member

Thanks for the feedback! It's strange that it works differently depending of the platform, it may be related to the underlying implementation of the native console object.
Anyway, I'll integrate the patch in a PR since it seems some browsers on Windows also have the issue.

sinedied added a commit that referenced this issue May 29, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants