xHarbour Reference Documentation > Function Reference xHarbour Developers Network  

TraceLog()

Traces and logs the contents of one or more variables.

Syntax

TraceLog( <xVariables,...> ) --> lTrue

Arguments

<xVariables>
This is a comma separated list of variables to trace during program execution.

Return

The function returns .T. (true).

Description

The TraceLog() function traces and logs the contents of one or more variables in the trace log file. Each time TraceLog() is called, a new entry is added to the log file. To suppress output of the function SET TRACE must be set to OFF.

Info

See also:AltD(), HB_BldLogMsg(), INIT LOG, SET ERRORLOG, SET TRACE
Category: Debug functions , Log functions , xHarbour extensions
Source:rtl\traceprg.prg
LIB:xhb.lib
DLL:xhbdll.dll

Example

// This example logs the contents of three variables in the trace.log file. The
// log contains type and value of the variables as well as the line number,
// procedure and source file where the trace was executed.

   PROCEDURE Main()
      LOCAL xValue1 := 1
      LOCAL xValue2 := 1
      LOCAL xValue3 := 1

      TraceLog( xValue1, xValue2, xValue3 )

      xValue1 := 2
      xValue2 := 33
      xValue3 := xValue1 + xValue2
      TraceLog( xValue1, xValue2, xValue3 )

      xValue1 := Str(++xValue1)
      xValue2 := 33
      xValue3 := xValue2++

      TraceLog( xValue1, xValue2, xValue3 )

      MemoEdit( Memoread( "Trace.log" ) )
   RETURN

Copyright © 2006-2007 xHarbour.com Inc. All rights reserved.
http://www.xHarbour.com
Created by docmaker.exe