se-sic / coronet

coronet – the R library for configurable and reproducible construction of developer networks
GNU General Public License v2.0
7 stars 15 forks source link

Make warnings more uniform #253

Open Leo-Send opened 8 months ago

Leo-Send commented 8 months ago

Description

PR#248 included a warning using the 'warning()' function which behaves differently from the 'logging::logwarn' function used elsewhere in the project. When using 'warning()', warnings are enumerated and repeated at the end of testruns and normal execution. When using 'logwarn()', the warning just appears in the logs alongside 'loginfo()' (albeit recoloured). Also, 'warning()' is used by external libraries used in coronet.

Motivation

It would be nice to make warnings uniform or introduce a distinction between the two types, so that you can more easily interpret the warning and act accordingly. I would prefer having specific cases when to use which warning, as the 'warning()' function produces warnings that are much harder to overlook whereas 'logwarn()' warnings can get lost in the hundreds of lines of log messages this project can produce. Thus it would make sense to use 'warning()' warnings in cases where the functionality of the program is likely to be broken, while using 'logwarn()' warnings in cases where the execution can most likely proceed normally, though some information might be lost on the way.

Ideas for the Implementation

Either only use one of the types or assign specific use cases for each of the warning types.

Additional Information

The new warning can be seen in 'util-networks-misc.R' line 154 and occurs during a test run of 'tests/test-util-networks-misc.R'.

Leo-Send commented 8 months ago

These are the warnings I found that i believe might profit from using 'warning()':

There is also a warning that i believe is not helpful at all to a user: