<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/">
    <channel>
        <title>System.out.println considered harmful</title>
        <description> I&#039;ve added a class (org.reprap.utilities.Debug) that handles all debugging information.

Including that in a file, then making a call to the static function Debug.d(String) will print the string to System.out if debugging is turned on, together with a timestamp.  Thus you get things like:

DEBUG: X axis - setting maximum torque to: 100 [0.317s/91ms]

The timestamp [0.317s/91ms] is the elapsed time since the first call to Debug in seconds, and the difference in time between this call and the last in ms.

A similar call to Debug.c(String) handles all the communications debugging:

comms: tx 0-&amp;gt;2: e 44  [0.318s/1ms]
comms: rx: 54 52 30 0 2 bd  [0.348s/30ms]

The difference in case is to make the two easier to distinguish when both are turned on.

Could we avoid writing anything to System.out in future, and instead call Debug.d?

Writing to System.err for actual errors is fine, of course.

Er -- debug information and complaints to me...</description>
        <link>https://reprap.org/forum/read.php?12,4967,4967#msg-4967</link>
        <lastBuildDate>Thu, 15 Oct 2026 06:47:27 -0400</lastBuildDate>
        <generator>Phorum 5.2.23</generator>
        <item>
            <guid>https://reprap.org/forum/read.php?12,4967,5151#msg-5151</guid>
            <title>Re: System.out.println considered harmful</title>
            <link>https://reprap.org/forum/read.php?12,4967,5151#msg-5151</link>
            <description><![CDATA[ hi adrian,<br />
<br />
the timing information is very nice and helpfull! <br />
and the debug-class is of course a good improvement too.<br />
<br />
thanks<br />
andreas]]></description>
            <dc:creator>Anonymous User</dc:creator>
            <category>RepRap Host</category>
            <pubDate>Sat, 22 Sep 2007 07:02:45 -0400</pubDate>
        </item>
        <item>
            <guid>https://reprap.org/forum/read.php?12,4967,4967#msg-4967</guid>
            <title>System.out.println considered harmful</title>
            <link>https://reprap.org/forum/read.php?12,4967,4967#msg-4967</link>
            <description><![CDATA[ I've added a class (org.reprap.utilities.Debug) that handles all debugging information.<br />
<br />
Including that in a file, then making a call to the static function Debug.d(String) will print the string to System.out if debugging is turned on, together with a timestamp.  Thus you get things like:<br />
<br />
DEBUG: X axis - setting maximum torque to: 100 [0.317s/91ms]<br />
<br />
The timestamp [0.317s/91ms] is the elapsed time since the first call to Debug in seconds, and the difference in time between this call and the last in ms.<br />
<br />
A similar call to Debug.c(String) handles all the communications debugging:<br />
<br />
comms: tx 0-&gt;2: e 44  [0.318s/1ms]<br />
comms: rx: 54 52 30 0 2 bd  [0.348s/30ms]<br />
<br />
The difference in case is to make the two easier to distinguish when both are turned on.<br />
<br />
Could we avoid writing anything to System.out in future, and instead call Debug.d?<br />
<br />
Writing to System.err for actual errors is fine, of course.<br />
<br />
Er -- debug information and complaints to me...]]></description>
            <dc:creator>Adrian Bowyer</dc:creator>
            <category>RepRap Host</category>
            <pubDate>Wed, 12 Sep 2007 16:45:17 -0400</pubDate>
        </item>
    </channel>
</rss>
