Skip to Main Content
C# in a Nutshell
book

C# in a Nutshell

by Ben Albahari, Ted Neward, Peter Drayton
March 2002
Intermediate to advanced content levelIntermediate to advanced
864 pages
31h 8m
English
O'Reilly Media, Inc.
Content preview from C# in a Nutshell

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 method DefaultTraceListener();  
// Public Instance Properties
   public field bool AssertUiEnabled{set; get; } 
   public field string LogFileName{set; get; } 
// Public Instance Methods
   public override method void Fail(string message);            // overrides TraceListener
   public override method void Fail(string message,              // overrides TraceListener
        string detailMessage);  
   public override method void Write(string message);           // overrides ...
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# 8.0 in a Nutshell

C# 8.0 in a Nutshell

Joseph Albahari, Eric Johannsen
C# 10 in a Nutshell

C# 10 in a Nutshell

Joseph Albahari
C# in a Nutshell, Second Edition

C# in a Nutshell, Second Edition

Peter Drayton, Ben Albahari, Ted Neward
Code like a Pro in C#

Code like a Pro in C#

Jort Rodenburg

Publisher Resources

ISBN: 0596001819Catalog PageErrata