Earlier quoted context omitted.
> In addition, something that is an error in a subcomponent may only be a warning or even just an info on the level of the superordinate component. Or, keep it simple. - error means someone is alerted urgently to look at the problem - warning means someone should be looking into it eventually, with a view to reclassifying as info/debug or resolving it. IMO many people don't care much about their logs, until the shit…
> - error means someone is alerted urgently to look at the problem The issue is that the code that encounters the problem may not have the knowledge/context to decide whether it warrants alerting. The code higher up that does have the knowledge, on the other hand, often doesn’t have the lower-level information that is useful to have in the log for analyzing the failure. So how do you link the two? When you write modu…
so your code isn't modular after all, because the code is _doing_ logging as a side-effect of the actual functionality.
The modularity of your code should mean that the outcome of the functionality is packaged into a bundle of data, and this bundle includes information about errors (or warnings) - aka, a status result.
The caller of this module will inspect this data, and they themselves will decide to log (or, if they are a module of their own, pass the data up again). This goes on, until the data goes into a logging layer - solely responsible for logging perhaps.