[
https://issues.apache.org/jira/browse/IMAGING-154?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16577458#comment-16577458
]
Bruno P. Kinoshita commented on IMAGING-154:
--------------------------------------------
So went ahead to re-design the Debug class, in a way users could still
enable/disable debugging, and also use a PrintStream so that other thing rather
than System.out could be used.
Then, realized removing System.out was the natural next step. But alas, the
library uses System.out for debugging, but sometimes it uses it for writing to
System.out in a "verbose mode". What is more complicated, is that sometimes
classes methods like `toString()` are calling debug methods that receive a
PrintStream already.
So I spent some more time quickly comparing what other libraries I've seen
being used / or used for image processing:
[https://kinoshita.eti.br/2018/08/12/use-of-logging-in-java-image-processing-libraries/.|https://kinoshita.eti.br/2018/08/12/use-of-logging-in-java-image-processing-libraries/]
Turns out only very low level libraries, such as the JNI bridge for OpenCV,
im4java, and Java's ImageIO can do with just throwing Exception's.
All other libraries have one way or another of logging. Be it with JUL, SLF4J,
custom loggers, or with the ol' System.out/err.
My preferred compromise for this ticket was to keep Debug, making System.out
possible but optional, and mark the class internal only. Now my preferred
solution is to keep the Debug internal, but add a logger to it. And then also
add logging to replace where System.out is used for the "verbose" mode.
> Remove Debug class
> ------------------
>
> Key: IMAGING-154
> URL: https://issues.apache.org/jira/browse/IMAGING-154
> Project: Commons Imaging
> Issue Type: Task
> Affects Versions: Patch Needed
> Reporter: Benedikt Ritter
> Assignee: Bruno P. Kinoshita
> Priority: Major
> Fix For: 1.0
>
>
> Low level libraries should not do logging, but communicate through the use of
> exceptions and meaningful return values. Remove the Debug class and all it's
> uses.
--
This message was sent by Atlassian JIRA
(v7.6.3#76005)