Re: Coding practice for better user-proofing

new topic     » goto parent     » topic index » view thread      » older message » newer message
fizzpopsoft said...

Is there a more elegant way to create/use a user debug level..?

Typically include a function called debug() and/or debugf() (like printf()) and let that function handle all the debugging nonsense.

procedure debugf( sequence msg, object data ) 
 
    -- where debug_level 1 is terse, 2 is normal messages, 3 is debug without proc/function names or passed vars 
    -- the rest of this function is removed.... writelog puts date/time in front too 
    if debug_level > 3 then 
        writelog( sprintf(msg, data) ) 
    end if 
 
end procedure 
 
function parse_sql_data(integer fieldnum, sequence data, sequence sql_delimiter) -- find between delimiters, drop spaces 
 
    sequence s1, s2, delimiter, space 
    integer i1, i2, i3, i4 
 
    space = " " 
    delimiter = sql_delimiter -- "|" 
    i3 = 0 
    s1 = data 
 
    debugf( "Debug 4 function 'parse_sql_data' called, using '%s'", {data} ) 
    debugf( "Debug 4 function 'parse_sql_data' called, field %10d", {fieldnum} ) 
 
end function 

-Greg

new topic     » goto parent     » topic index » view thread      » older message » newer message

Search



Quick Links

User menu

Not signed in.

Misc Menu