Share via


WTTLogUserDefinedTrace function

The WTTLogUserDefinedTrace function logs trace data by using a user-defined trace level and the specified priority.

Syntax

HRESULT WTTLogUserDefinedTrace(
  LONG hDevice,
  LPCWSTR pwszUserLevel,
  DWORD dwBaseLevel,
  DWORD dwPriority,
   ...
);

Parameters

  • hDevice
    [in] A handle to the device tracing topology. You can combine multiple handles by using the bitwise OR operator (for example, hDevice1 OR hDevice2).

  • pwszUserLevel
    [in] A user-defined trace level.

  • dwBaseLevel
    [in] A base trace level. This parameter should be one of the following values:

    • WTT_LVL_MSG
      Trace a user-define message. This trace is the most commonly used trace. If all traces within the context of a particular test case are messages, function entry, function exit, TCM information, or machine information, the test case will pass.

    • WTT_LVL_ERR
      Trace an error. This trace causes the logger (in the usermode) to fail a test case unless a bug trace is logged or you declare the test case as "skipped".

    • WTT_LVL_ASSERT
      Trace an assertion. This trace causes the logger (in the user mode) to fail a test case unless a bug trace is logged or you declare the test case as "skipped".

    • WTT_LVL_INVALID_PARAM
      Trace an invalid parameter. This trace causes the logger (in the user mode) to fail a test case unless a bug trace is logged or you declare the test case as "skipped".

    • WTT_LVL_BUG
      Trace a known bug. This trace causes the logger (in the user mode) to log a test case as "blocked", unless you declare the test case as "skipped".

    • WTT_LVL_BREAK
      Trace a debug break. This trace causes the logger (in the user mode) to fail a test case unless a bug trace is logged or you declare the test case as "skipped".

    • WTT_LVL_WARN
      Trace a warning message. This trace causes the logger (in the user mode) to log the test case as "warned", unless an error or bug trace is logged or you declare the test case as "skipped".

    • WTT_LVL_FUNCTION_ENTRY
      Trace the function entry point. This value does not affect the test case result.

    • WTT_LVL_FUNCTION_EXIT
      Trace the function exit point. This value does not affect the test case result.

    • WTT_LVL_START_TEST
      Trace the start of a test case. This value marks the beginning of a test case and sets a new context whose name is the current test case name. However, you should call the StartTest method instead of using this level.

    • WTT_LVL_END_TEST
      Trace the end of a test case. This value marks the end of a test case and clears a new context whose name is the current test case name. It also updates the internal pass-fail counter according to the pass-fail mode and the previous traces. However, you should call the EndTest method instead of using this level.

    • WTT_LVL_TCMINFO
      Sets the Tactics fields. This value does not affect the test case result.

    • WTT_LVL_MACHINEINFO
      Sets machine-related test case fields for Tactics. This value does not affect the test case result

    • WTT_LVL_ROLLUP
      Trace the test suite roll-up information. If the pass-fail mode is set to "user", the user plug-in must provide its own pass-fail count. Otherwise, DTM Logger will overwrite the counters that you provide and use its internal counts. However, this value does not cause DTM to perform a rollup operation.

  • dwPriority
    [in] The priority of the trace. This parameter should be one of the following values: WTT_TRACE_PRIORITY_HIGH_CLASSWTT_TRACE_PRIORITY_MEDIUM_CLASSWTT_TRACE_PRIORITY_LOW_CLASSWTT_TRACE_PRIORITY_RESERVED_CLASSWTT_TRACE_PRIORITY_USER_CLASS

  • ...
    [in] One or more optional arguments that depend on the trace level that is specified in the pwszUserLevel parameter. For information about the arguments that are required for each trace level, see Trace Level.

Return value

WTTLogUserDefinedTrace returns one of the following values:

Return code Description
S_OK

The operation was successful.

S_FALSE

The operation was successful but the last device has been detached, which has triggered a rollup.

HRESULT

The operation failed. You should use the FAILED macro to check HRESULT values.

 

Remarks

User-defined trace levels must be enabled for them to be traced in the log. You can enable custom trace levels on a device by using a device string, such as "$LogFile:EnableLvl=MyTrace".

Requirements

Header

Wttlogger.h

Library

WTTLog.dll

See also

WTTLog Functions (C)

WTTLogUserDefinedTraceEx

 

 

Build date: 9/14/2012