scenerygraphics / sciview

sciview is a tool for visualization and interaction with ND image and mesh data
BSD 2-Clause "Simplified" License
67 stars 17 forks source link

Debug messages are printed to `System.out` #56

Closed rimadoma closed 6 years ago

rimadoma commented 6 years ago

Debug messages should be printed using LogService.debug(String) instead of System.out.println(String) so that they can be hidden.

skalarproduktraum commented 6 years ago

Hey @rimadoma,

so I'm using slf4j for that at the moment, not directly System.out/err.println(). I'll investigate how both could be coupled. Does the LogService support string interpolation as slf4j does? (Maybe @ctrueden knows?) I'm asking because slf4j has this very nice optional string interpolation which only gets executed in case you are actually using this log level, which is very useful for debug and trace logging.

rimadoma commented 6 years ago

@skalarproduktraum at least you can set logging level, and it's also an option the user can set in ImageJ / Fiji from Options > ImageJ2. Messages below the level are not shown.

ctrueden commented 6 years ago

Logging in SciJava is explained here: https://imagej.net/Logging

The optional scijava-log-slf4j logging plugin pipes all SciJava log output into SLF4J, so you can feed SciJava logging into the logging framework of your choice via SLF4J that way. (Without this plugin, SciJava logging ultimately ends up on stderr/stdout.)

The SciJava logging framework itself does not support string interpolation.

I think Scenery sticking with SLF4J is probably just fine—no need to switch everything. However, I think the System.out.println calls to which @rimadoma refers are here in SciView—try git grep System.out to see them. Since SciView is already built on SciJava, make it makes sense for SciView to use the SJC LogService?

skalarproduktraum commented 6 years ago

Okay, it's helpful to read issues fully, I was under the impression this was filed with scenery xD

For SciView, it should be fine to use the logging service.

kephale commented 6 years ago

Done