AFrieze
AFrieze

Reputation: 844

Logging with ng serve for CLI angular2

I have a project running on the CLI for Angular2. During local development, I'd like to see the http requests the come in. The server is started using ng serve Does anyone know how to turn logging on for this?

Upvotes: 1

Views: 3383

Answers (2)

Johan Aspeling
Johan Aspeling

Reputation: 807

I got error logs by using this command:

node 2> widgets.container_err.log ./node_modules/@angular/cli/bin/ng serve

The output is not that great, but it does output any errors thrown through node

Upvotes: 1

David Pascoal
David Pascoal

Reputation: 1441

There is no out-of-the-box logger for angular 2 cli.

However, there is a compatible library you can install: ng2-logger https://www.npmjs.com/package/ng2-logger

All you need to do is a simple npm install and import it directly into the files you want to use it (no need to register it in the modules).

Upvotes: 0

Related Questions