I thought about this question today for some reason. Since part is about how functions idempotent so you can't use current-dateTime() to get different times, if what you really want is to put timestamps in certain places, you can do that instead of changing logging.
If you can assume that you will be using saxon for your test, and you are willing to assume that the the XSLT statements will be evaluated in order, then you can use java extension functions. I figure that that is a reasonable assumption for one's test code. Not for production code. For example:
<xsl:transform version="2.0"
xmlns:xsl="
http://www.w3.org/1999/XSL/Transform"
xmlns:f="f"
exclude-result-prefixes="#all">
<xsl:output method="text"/>
<xsl:function name="f:now"
xmlns:date="java:java.util.Date"
exclude-result-prefixes="#all">
<xsl:sequence select="date:new()"/>
</xsl:function>
<xsl:function name="f:timestamp"
xmlns:date="java:java.util.Date"
xmlns:date-format="java:java.text.SimpleDateFormat"
exclude-result-prefixes="#all">
<xsl:param name="fmt"/>
<xsl:param name="d"/>
<xsl:value-of select="date-format:format(date-format:new($fmt), $d)"/>
</xsl:function>
<xsl:function name="f:timestamp"
xmlns:date="java:java.util.Date"
exclude-result-prefixes="#all">
<xsl:param name="fmt"/>
<xsl:value-of select="f:timestamp($fmt, date:new())"/>
</xsl:function>
<xsl:function name="f:duration"
xmlns:date="java:java.util.Date"
xmlns:time="java:java.util.concurrent.TimeUnit"
exclude-result-prefixes="#all">
<xsl:param name="s"/>
<xsl:param name="e"/>
<xsl:variable name="since" select="date:get-time($e) - date:get-time($s)"/>
<xsl:sequence select="(time:to-hours(time:MILLISECONDS(), $since),
time:to-minutes(time:MILLISECONDS(), $since),
time:to-seconds(time:MILLISECONDS(), $since),
time:to-millis(time:MILLISECONDS(), $since) mod 1000)"/>
</xsl:function>
<xsl:template match="/">
<xsl:variable name="start-time" select="f:now()"/>
<xsl:message><xsl:value-of select="concat('Starting at ', f:timestamp('yyyy-MM-dd hh:mm:ss.S', $start-time))"/></xsl:message>
<xsl:message>Working...</xsl:message>
<xsl:value-of xmlns:thread="java:java.lang.Thread"
select="thread:sleep(5000)"/>
<xsl:variable name="end-time" select="f:now()"/>
<xsl:message><xsl:value-of select="concat('Ending at ', f:timestamp('yyyy-MM-dd hh:mm:ss.S', $end-time))"/></xsl:message>
<xsl:variable name="duration" select="f:duration($start-time, $end-time)"/>
<xsl:message><xsl:value-of select="concat($duration[1], ' hours ',
$duration[2], ' minutes ',
$duration[3], ' seconds ',
$duration[4], ' milliseconds')"/></xsl:message>
</xsl:template>
</xsl:transform>
The duration function returns a sequence with hours, minutes, seconds and milliseconds. You pass it a start and end time and the result represents the duration.