我正在Vue项目中尝试使用debug package。 我已经做了一些步骤,但是没有用:
npm install debug
<script>
import debug from 'debug'
const log = debug('app:logging')
export default {
...
created(){
log('testing logging');
}
...
}
<script>
$env:DEBUG='app:*'; npm run serve
set DEBUG=app:* & npm run serve
[dotenv][DEBUG] "DEBUG" is already defined in "process.env" and will not be overwritten
我应该怎么做才能使它正常工作?我想在控制台中看到消息testing logging
。
答案 0 :(得分:0)
只需阅读documentation:
var log = debug('app:log'); // set this namespace to log via console.log log.log = console.log.bind(console); // don't forget to bind to console! log('goes to stdout');