Reply To: Logging related questions

Clovertech Forums Read Only Archives Cloverleaf Cloverleaf Logging related questions Reply To: Logging related questions

#57816
Jonathan Hamilton
Participant

    You cannot create info or debug messages.

    You can create your own formatted message and echo it in your proc which effectively writes it to the log file.  To get functionality similar to the info level you can pass an argument to turn logging statements on and off.  I wish it was possible to find the current EO info level from within a UPoC so logging could become even more detailed and controllable without an engine bounce.

    Example Code:

    package require utilities

    if {![keylget args ARGS.DEBUG debug]} { set debug “0” }

    log_it2 “Module called from wrong CONTEXT in the engine.” 1

    log_it “Didn’t find any files matching pattern ‘.in.${tmpObfile}’ in ${ftpobdir}.”

    Package Library:

    package provide utilities 1.2

    proc log_it {msg {ovrde 0}} {

       global HciConnName

       upvar #1 module module mh mh debug debug

       if {$debug || $ovrde} {

           set mid [get_mid $mh]

           set msg “[tcl :tcl :USER/9:[format %20s $HciConnName]] [$mid] Module ‘$module’: $msgr”

           echo $msg

       }

    }

    Sample Output:

    [tcl :tcl :USER/9:adt_smrt_out_QA1A_04427_541] [0.0.320032] Module ‘tps_ob_upoc_ftp_gnrc’: Didn’t find any files matching pattern ‘PT1*’ in /mm03/data.

    [tcl :tcl :USER/9:adt_smrt_out_QA1A_04427_541] [0.0.320032] Module ‘tps_ob_upoc_ftp_gnrc’: The file name ‘PT111177.04427’ already exists on the remote server!

    [tcl :tcl :USER/9:adt_smrt_out_QA1A_04427_541] [0.0.320032] Module ‘tpsShowMode’: Protocol driver experienced an error.  Re-queuing message for another attempt at delivery.

    [tcl :tcl :USER/9:adt_smrt_out_QA1A_04427_541] [0.0.320032] Module ‘tpsShowMode’: Halting thread to allow protocol error time to resolve.