Skip to Main Content
C# in a Nutshell, Second Edition
book

C# in a Nutshell, Second Edition

by Peter Drayton, Ben Albahari, Ted Neward
August 2003
Intermediate to advanced content levelIntermediate to advanced
928 pages
32h 1m
English
O'Reilly Media, Inc.
Content preview from C# in a Nutshell, Second Edition

Name

DefaultTraceListener

Synopsis

This class provides the default TraceListener. By default, an instance of this class is available in the Listeners collection of the Debug and Trace classes. The Write( ) and WriteLine( ) methods output to the log and to the active debugger (if any) via the Win32 API function OutputDebugString. The log file is initially unset, so output goes only to the debugger. To specify a log file, set LogFileName. You may also set a logfile in the <assert> element of the application configuration file’s <system.diagnostics> section, as in <assert logfilename="logfile.log"/>.

AssertUiEnabled determines whether to use the user interface for failed assertions. If true, .NET uses a dialog box with the options Abort, Retry, or Fail. Whether this property is set to true or false, .NET always writes messages to the LogFileName, if one is specified. The AssertUiEnabled property can be set using the <assert> element, as in <assert assertuienabled="false"/> (the default is true).

public class DefaultTraceListener : TraceListener {
// Public Constructors
   public DefaultTraceListener( );
// Public Instance Properties
   public bool AssertUiEnabled{set; get; }
   public string LogFileName{set; get; }
// Public Instance Methods
   public override void Fail(string message);
// overrides TraceListener
   public override void Fail(string message, string detailMessage);  
// overrides TraceListener
   public override void Write(string message);
// overrides TraceListener public override void ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

C# in a Nutshell

C# in a Nutshell

Ben Albahari, Ted Neward, Peter Drayton
C# 7.0 in a Nutshell

C# 7.0 in a Nutshell

Joseph Albahari, Ben Albahari
C# Cookbook, 2nd Edition

C# Cookbook, 2nd Edition

Jay Hilyard, Stephen Teilhet
C# Cookbook

C# Cookbook

Stephen Teilhet, Jay Hilyard

Publisher Resources

ISBN: 0596005261Catalog PageErrata