Skip to content

Use SciJava Log2 Logger within SciJava Discoverer implementations #106

@gselzer

Description

@gselzer

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 Logger to the discover function. I dislike this, I don't like metaparameters leaking into signatures.
  • Make a LoggingDiscoverer interface with getters/setters for a Logger.
  • Make a static method somewhere that each Discoverer could call to log errors. Would different Discoverers ever want to log to different outputs? If so, this probably is a bad idea.

Metadata

Metadata

Labels

Type

No type

Projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions