Posted to tcl by centrix at Wed Sep 25 07:07:24 GMT 2019view pretty

proc ::writeToUserLog { txmsg } {
        set this_proc [lindex [info level 0] 0]
        __debug "INFO|$this_proc|Writing a line to app logfile..."
        if [ info exists ::userLogFile ] {
                if { [catch { open ${::userLogFile} a } f] } {
                        __debug "ERR|$this_proc|open to write to '$::userLogFile':$f"
                        return 0
                }
                set now [clock format [clock seconds] -format "%m/%d/%Y %T"]
                puts $f "$now|$txmsg"
                close $f
        }
        return 1
}



itcl::body WorkTableDetail::constructor {} {
    ...
    ::writeToUserLog "INFO|procedureXYZ|text1"
}

#############
invalid command name "::writeToUserLog"
invalid command name "::writeToUserLog"
    while executing
"::writeToUserLog "INFO|$_this_proc|Setting widgets based on roles.""
    while constructing object "::.work_table_report_assDetail.detail" in ::WorkTableDetail::constructor (body line 34)
    invoked from within
"$itk_option(-detailclass) $detailObject $_reportName $this $_resultWidget"
...