简体   繁体   English

使用 ng serve 记录 CLI angular2

[英]Logging with ng serve for CLI angular2

I have a project running on the CLI for Angular2.我有一个在 Angular2 的 CLI 上运行的项目。 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?在本地开发过程中,我想看到 http 请求进来。服务器是使用ng serve启动的 有谁知道如何为此打开登录?

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. angular 2 cli 没有开箱即用的记录器。

However, there is a compatible library you can install: ng2-logger https://www.npmjs.com/package/ng2-logger但是,您可以安装一个兼容的库: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).您需要做的只是一个简单的 npm install 并将其直接导入到您要使用的文件中(无需在模块中注册)。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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