Tcl Library Source Code

View Ticket
Login
Ticket UUID: 1779624
Title: Execute a command only when debug is active.
Type: RFE Version: None
Submitter: pfinnegan Created on: 2007-08-22 18:45:45
Subsystem: log Assigned To: andreas_kupries
Priority: 5 Medium Severity:
Status: Closed Last Modified: 2026-11-21 10:33:57
Resolution: Out of Date Closed By: serhiy.storchaka
    Closed on: 2026-11-21 10:33:57
Description:
e.g display the results of info script when debug is active. 

something like:
 
::log::lvSuppressLE emergency 0

::log::log debug [ info script ]
User Comments: serhiy.storchaka added on 2026-11-21 10:33:57:

log::logsubst debug {... [cmd] ...} ([ea802e332b], log 1.4, Tcllib 1.20) runs the substitution only when the level is active; log::lvIsSuppressed can guard any code.


mic42 added on 2008-03-14 02:58:05:
Logged In: YES 
user_id=302287
Originator: NO

This can be done with the logger package with a custom logproc that uplevels, look at the examples at the end of the manpage:
http://tcllib.sourceforge.net/doc/logger.html