简体   繁体   中英

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?

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

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).

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM