[GeoNetwork-devel] Use of console

Hi,

I have been noticing that there are more and more console warnings and
errors in GeoNetwork that are hidden to the user. In fact, only on
pure GeoNetwork code we have close to a hundred of this kind of
warnings:

$ rgrep "console." web-ui/src/main/resources/catalog | grep -v "/lib" | wc -l
98

This is not a bad practice itself, but it can be a bad practice if we
use it without any warning to the final user. Sometimes, an error
happens and the final user has no clue what was wrong. Maybe an error
or warning message will not fix the problem, but sometimes some more
information can give some indication to the user. Specially if the
problem is between the chair and the keyboard :slight_smile:

Please, be careful when you use console.log, console.warn or
console.error and always try to leave some trace on the user
interface.

Let me remind you that we have an alert service that works quite well:

https://github.com/geonetwork/core-geonetwork/blob/develop/web-ui/src/main/resources/catalog/components/common/alert/Alert.js

Just add it as a dependency to your angular service or controller and
use it like this:

gnAlertService.addAlert({
             msg: '$MESSAGE'
             type: '$LEVEL'
           }, $MILISECONDS_TO_BE_SHOWN);

$MILISECONDS_TO_BE_SHOWN is optional.

$LEVEL can be "info", "success", "warning" or "danger".

Have a happy day!
MarĂ­a.