#323 formatted log::log for performence

log (11)

Propose to add a command:
log::logf Level Formatpattern ?arg1? ?arg2? ?arg3?
which is equal in functionality to:
log::log Level [format Formatpattern ?arg1? ?arg2? ?arg3?]
for performence reasons.
Current solution to log a variable contents:
(1) log::log debug "Variable V=$V"
Proposed solution:
(2) log:logf debug "Variable V=%s" $V
If log level "debug" is activated, there is little difference.
If log level "debug" is not activated, (1) will still compose the log string, (2) will not.
For complex cases, this might be a considerable performence difference.


  • Andreas Kupries

    Andreas Kupries - 2010-09-15

    A more standard way would be, I believe, to use [subst] internally, not [format]. That way we just have to change "..."-quoting to {...}-quoting (and, of course, change the name of the log command).
    Alternatively, keep the name, i.e. "log", then this is a major API change, forcing a major version change, i.e. 1.3 -> 2.

    The subst is certainly what wub's Debug package does.

  • Harald Oehlmann

    Harald Oehlmann - 2011-05-11

    Indeed, subst gives more power than format.

    format would be similar how the msgcat package handles things.


Get latest updates about Open Source Projects, Conferences and News.

Sign up for the SourceForge newsletter:

No, thanks