JabRef / JabRef-Word-Addin

MIT License
23 stars 7 forks source link

Add logging #150

Open k3KAW8Pnf7mkmdSMPHz27 opened 3 years ago

k3KAW8Pnf7mkmdSMPHz27 commented 3 years ago

Perhaps we should add "no-console": "off", to the eslint rules. I am interested in opinions, particularly if there is a better approach for debugging here. Based on that "Runtime logging delivers console.log statements to a separate log file you create to help you uncover issues. I'd say it seems the official approach.

Off-topic: Instructions for starting runtime logging

tobiasdiez commented 3 years ago

Some form of logging is of course nice for development. The problem with console.log is that you cannot disable it in production, where you don't want to flood the console view but only print errors.

The solution is to use a logging library. I don't have much experience/opinion here, but https://www.npmjs.com/package/debug and https://www.npmjs.com/package/loglevel are the most-used ones. I also came across https://www.npmjs.com/package/ulog which seems to be a nice modern hybrid, but it is way less used. Maybe give it a shot nonetheless if it works than it works?

https://www.npmtrends.com/js-logger-vs-log4js-vs-loglevel-vs-morgan-vs-pino-vs-winston-vs-ulog