Forum Discussion

AlexS_yb's avatar
AlexS_yb
Icon for Cirrocumulus rankCirrocumulus
Jul 25, 2022

irule proc with default values failing

Hi I have a proc defined as proc loggingNowStr { log_now_clock log_now_msec } { set log_now_diff [expr { $log_now_msec - ( $log_now_clock * 1000 ) }] incr log_now_clock [ expr { $log_now_dif...
  • AlexS_yb's avatar
    AlexS_yb
    Jul 28, 2022

    Hi

    when i try this

    rule proc_lib {
    proc loggingNowStr2 { {log_now_clock 0} {log_now_msec 0} } {
    }

    }

    i get this

    01070151:3: Rule [/Common/YB_SOEv2_Platform_logging_v1.1] error: /Common/YB_SOEv2_Platform_logging_v1.1:53: error: [undefined procedure: rule][rule proc_lib {
    proc loggingNowStr2 { {log_now_clock 0} {log_now_msec 0} } {
    }

    }]

     

    I have my proc outside rule proc_lib

    why do you use rule proc_lib ?

     

     

    I tried your code - started a new irule and got this error

    01070151:3: Rule [/Common/test] error: /Common/test:1: error: [undefined procedure: rule][rule proc_lib {
    proc loggingNowStr { {log_now_clock 123456789} {log_now_msec 78341239432} } {
    set log_now_diff [expr { $log_now_msec - ( $log_now_clock * 1000 ) }]
    incr log_now_clock [ expr { $log_now_diff / 1000 }]
    set log_now_fract [expr { $log_now_diff % 1000 }]
    set log_now_fract [format "%03d" $log_now_fract]
    set log_now_start_time_str [clock format $log_now_clock -format "%Y-%m-%d %H:%M:%S.${log_now_fract}"]

    return $log_now_start_time_str
    }
    }]