CDnsClient::EnableTrace
BOOL EnableTrace(
LPCTSTR lpszTraceFile,  
DWORD dwTraceFlags  
);

The EnableTrace method enables the logging of socket function calls to a file.

Parameters

lpszTraceFile
A null-terminated string which specifies the name of the trace log file. If this parameter is NULL or an empty string, the default file name cstrace.log is used. The file is stored in the directory specified by the TEMP environment variable, if it is defined; otherwise, the current working directory is used.
dwTraceFlags
Detail level of the trace.
Value Constant Description
0 TRACE_ALL All function calls are written to the trace file. This is the default value.
1 TRACE_ERROR Only those function calls which fail are recorded in the trace file.
2 TRACE_WARNING Only those function calls which fail or return values which indicate a warning are recorded in the trace file.
4 TRACE_HEXDUMP All methods calls are written to the trace file, plus all the data that is sent or received is displayed, in both ASCII and hexadecimal format.

Return Value

If the method succeeds, the return value is non-zero. A return value of zero indicates an error. Failure typically indicates that the tracing library cstrace6.dll cannot be loaded on the local system.

Remarks

When trace logging is enabled, the file is opened, appended to and closed for each socket function call. This makes it possible for an application to append its own logging information, however care should be taken to ensure that the file is closed before the next network operation is performed. To limit the size of the log files, enable and disable logging only around those sections of code that you wish to trace.

Note that the TRACE_HEXDUMP trace level generates very large log files since it includes all of the data exchanged between your application and the remote host.

Trace method logging is managed on a per-thread basis, not for each client handle. This means that all SocketTools libraries and components share the same settings in the current thread. If you are using multiple SocketTools libraries or components in your application, you only need to enable logging once.

Requirements

Client: Requires Windows Vista, Windows XP or Windows 2000 Professional.
Server: Requires Windows Server 2008, Windows Server 2003 or Windows 2000 Server.
Header: Include cstools6.h.
Library: Use csdnsav6.lib.
Unicode: Implemented as Unicode and ANSI versions.

See Also

DisableTrace


Copyright © 2008 Catalyst Development Corporation. All rights reserved.