-
Notifications
You must be signed in to change notification settings - Fork 2
Use SciJava Log2 Logger within SciJava Discoverer implementations #106
Copy link
Copy link
Closed
scijava/incubator
#82Description
Each Discoverer is responsible for reporting an arbitrary number of implementations for each call to Discoverer.discover().
Sometimes, these Discoverers might find that one of the implementations is incorrect in some way. Instead of throwing an error, I think the principle of least surprise suggests that they should notify the user and move on, returning the correct discoveries instead of none at all. SciJava Log2's Logger class would be perfect for this.
Unfortunately, though, we don't provide the API for Discoverers to access a Logger, so as @ctrueden noticed Discoverers either use Throwable.printStackTrace or just use System.out.println or the equivalent.
I don't have a great idea of how to solve this. Off the top of my head we could:
- Add a
Loggerto thediscoverfunction. I dislike this, I don't like metaparameters leaking into signatures. - Make a
LoggingDiscovererinterface with getters/setters for aLogger. - Make a static method somewhere that each
Discoverercould call to log errors. Would differentDiscoverers ever want to log to different outputs? If so, this probably is a bad idea.
Reactions are currently unavailable