Tcl Library Source Code

View Ticket
Login
2018-05-18
04:17 • Closed ticket [19607f927b]: add log::logsubst to optimize logging of expensive to build messages plus 5 other changes artifact: aed38e84e2 user: aku
04:15
log / log <EF> Ticket [19607f927b] Merged new `logsubst` command to prevent execution of expensive message construction until actually needed. Version bumped to 1.4. Thanks to Harald for idea and implementation. check-in: ea802e332b user: aku tags: trunk
2018-05-17
19:42 • Ticket [19607f927b] add log::logsubst to optimize logging of expensive to build messages status still Open with 5 other changes artifact: 3930024e8d user: aku
2018-03-15
16:49 • Ticket [19607f927b]: 4 changes artifact: 02229be232 user: aku
2018-03-12
09:26 • Ticket [19607f927b]: 3 changes artifact: 2a6d479a64 user: oehhar
2018-02-21
10:08 • Ticket [19607f927b]: 3 changes artifact: a97a8059ff user: oehhar
2018-02-20
08:49 • Ticket [19607f927b]: 5 changes artifact: 740e455167 user: oehhar
2018-02-19
15:09
Add log::logsubst with command/variable substitution only in the log case. Ticket [19607f927b] check-in: ec9cf4bb6f user: oehhar tags: rfe-19607f927b-logeval
15:06 • New ticket [19607f927b] add log::logeval to optimize logging of expensive to build messages. artifact: 3a5a2bf648 user: oehhar

Ticket UUID: 19607f927b68c8d98d385ccb2efa7bdb2f86669e
Title: add log::logsubst to optimize logging of expensive to build messages
Type: RFE Version: trunk
Submitter: oehhar Created on: 2018-02-19 15:06:11
Subsystem: log Assigned To: aku
Priority: 8 Severity: Minor
Status: Closed Last Modified: 2018-05-18 04:17:01
Resolution: Accepted Closed By: aku
    Closed on: 2018-05-18 04:17:01
Description:

It might be expensive to build a log message:

log::log debug "XML of node $Node is '[$node asXml]'"

An extensive xml representation is build for log purposes and thrown away if not logged.

It is proposed to add a command logsubst, to do variable and command expansion only in the log case:

log::logsubst debug {XML of node $Node is '[$node asXml]'}

The substitution is done within the log command only if debug log level is set.

Implementation starting with commit [ec9cf4bb6f] in branch [rfe-19607f927b-logeval].

A practical usage is tclws (where the upper examples come from). The following commit introduces this optimisation and includes an emulator for older tcllib log packages:

https://core.tcl.tk/tclws/info/150950db68b9163a

User Comments: aku added on 2018-05-18 04:17:01:

All good, merged with commit [ea802e332b].


aku added on 2018-05-17 19:42:51:
Looks good. TODO (self): Run tests, validate docs, merge on success.

aku added on 2018-03-15 16:49:50:
Taking for review ...