JabRef-Word-Addin icon indicating copy to clipboard operation
JabRef-Word-Addin copied to clipboard

Add logging

Open k3KAW8Pnf7mkmdSMPHz27 opened this issue 4 years ago • 1 comments

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

k3KAW8Pnf7mkmdSMPHz27 avatar Aug 11 '21 15:08 k3KAW8Pnf7mkmdSMPHz27

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

tobiasdiez avatar Aug 11 '21 19:08 tobiasdiez