Re: new feature request: determining what the trace level is

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

Hi,
To easily restrict tracing to the bits of code I am interested in, (mine :)) a new function "trace_level" would be useful.

This would return the current value of trace. To be used as per this example:

global function bug_free_library_function(integer i1) 
      integer i2 
      i2 = trace_level() 
      -- function code here 
      i1 = 0 
      -- now restore the previous trace level, just before return 
      trace(i2) 
      return "success!" 
end function         
 
procedure my_buggy_proc() 
      sequence s1 
      integer i1 
      trace(1) 
      -- my buggy code here.. 
      i1 = 0 
      -- then a standard library call where I don't need trace on... 
      s1 = bug_free_library_function(i1) 
      -- the rest of my buggy code here 
end procedure 
 


Also, it would be nice to optionally suppress the display of trusted call variables and thier values from ex.err.
Comments ?

Regards, Alan

This is not really practical because we are not going to add 'trace_level' to every standard library function just so users can avoid tracing through them.

However, you do know that you can press the down-arrow to avoid tracing through a function call?

The idea you suggest has some merit but I'd like to do it slightly differently. Let's make the trace() call a function instead. It can return the current trace level while setting a new level, and because we no longer have to use a function's return value, current code would not be affected.

global function bug_free_function(integer i1) 
      integer i2 
      i2 = trace(0) -- turn any tracing off 
      -- function code here 
      i1 = 0 
      -- now restore the previous trace level, just before return 
      trace(i2)  
      return "success!" 
end function         
 
procedure my_buggy_proc() 
      sequence s1 
      integer i1 
      trace(1) 
      -- my buggy code here.. 
      i1 = 0 
      -- then a library call where I don't need trace on... 
      s1 = bug_free_function(i1) 
      -- the rest of my buggy code here 
end procedure 
new topic     » goto parent     » topic index » view thread      » older message » newer message

Search



Quick Links

User menu

Not signed in.

Misc Menu