You've already forked linux-packaging-mono
Imported Upstream version 4.2.0.179
Former-commit-id: 0a113cb3a6feb7873f632839b1307cc6033cd595
This commit is contained in:
committed by
Jo Shields
parent
183bba2c9a
commit
6992685b86
@@ -1,79 +0,0 @@
|
||||
//
|
||||
// System.Diagnostics.BooleanSwitch.cs
|
||||
//
|
||||
// Author:
|
||||
// John R. Hicks (angryjohn69@nc.rr.com)
|
||||
// Jonathan Pryor (jonpryor@vt.edu)
|
||||
//
|
||||
// (C) 2001-2002
|
||||
//
|
||||
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining
|
||||
// a copy of this software and associated documentation files (the
|
||||
// "Software"), to deal in the Software without restriction, including
|
||||
// without limitation the rights to use, copy, modify, merge, publish,
|
||||
// distribute, sublicense, and/or sell copies of the Software, and to
|
||||
// permit persons to whom the Software is furnished to do so, subject to
|
||||
// the following conditions:
|
||||
//
|
||||
// The above copyright notice and this permission notice shall be
|
||||
// included in all copies or substantial portions of the Software.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
||||
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
||||
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
||||
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
||||
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
//
|
||||
using System.Globalization;
|
||||
|
||||
namespace System.Diagnostics
|
||||
{
|
||||
/// <summary>
|
||||
/// Provides a simple on/off switch that controls debugging
|
||||
/// and tracing output
|
||||
/// </summary>
|
||||
[SwitchLevel (typeof (bool))]
|
||||
public class BooleanSwitch : Switch
|
||||
{
|
||||
/// <summary>
|
||||
/// Initializes a new instance
|
||||
/// </summary>
|
||||
public BooleanSwitch(string displayName, string description)
|
||||
: base(displayName, description)
|
||||
{
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance
|
||||
/// </summary>
|
||||
public BooleanSwitch(string displayName, string description, string defaultSwitchValue)
|
||||
: base(displayName, description, defaultSwitchValue)
|
||||
{
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Specifies whether the switch is enabled or disabled
|
||||
/// </summary>
|
||||
public bool Enabled {
|
||||
// On .NET, any non-zero value is true. Only 0 is false.
|
||||
get {return SwitchSetting != 0;}
|
||||
set {
|
||||
SwitchSetting = Convert.ToInt32(value);
|
||||
}
|
||||
}
|
||||
|
||||
protected override void OnValueChanged ()
|
||||
{
|
||||
int i;
|
||||
if (int.TryParse (Value, out i))
|
||||
Enabled = i != 0;
|
||||
else
|
||||
Enabled = Convert.ToBoolean (Value);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,40 +0,0 @@
|
||||
//
|
||||
// System.Diagnostics.ConsoleTraceListener.cs
|
||||
//
|
||||
// Authors:
|
||||
// Ben Maurer <bmaurer@andrew.cmu.edu>
|
||||
//
|
||||
// (C) 2006 Novell, Inc.
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining
|
||||
// a copy of this software and associated documentation files (the
|
||||
// "Software"), to deal in the Software without restriction, including
|
||||
// without limitation the rights to use, copy, modify, merge, publish,
|
||||
// distribute, sublicense, and/or sell copies of the Software, and to
|
||||
// permit persons to whom the Software is furnished to do so, subject to
|
||||
// the following conditions:
|
||||
//
|
||||
// The above copyright notice and this permission notice shall be
|
||||
// included in all copies or substantial portions of the Software.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
||||
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
||||
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
||||
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
||||
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
//
|
||||
using System;
|
||||
|
||||
namespace System.Diagnostics {
|
||||
public class ConsoleTraceListener : TextWriterTraceListener {
|
||||
public ConsoleTraceListener () : this (false) {}
|
||||
public ConsoleTraceListener (bool useErrorStream) :
|
||||
base (useErrorStream ? Console.Error : Console.Out) {}
|
||||
|
||||
internal ConsoleTraceListener (string data) :
|
||||
this (Convert.ToBoolean (data)) {}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,69 +0,0 @@
|
||||
//
|
||||
// CorrelationManager.cs
|
||||
//
|
||||
// Author:
|
||||
// Atsushi Enomoto <atsushi@ximian.com>
|
||||
//
|
||||
// Copyright (C) 2007 Novell, Inc.
|
||||
//
|
||||
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining
|
||||
// a copy of this software and associated documentation files (the
|
||||
// "Software"), to deal in the Software without restriction, including
|
||||
// without limitation the rights to use, copy, modify, merge, publish,
|
||||
// distribute, sublicense, and/or sell copies of the Software, and to
|
||||
// permit persons to whom the Software is furnished to do so, subject to
|
||||
// the following conditions:
|
||||
//
|
||||
// The above copyright notice and this permission notice shall be
|
||||
// included in all copies or substantial portions of the Software.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
||||
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
||||
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
||||
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
||||
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
//
|
||||
|
||||
using System;
|
||||
using System.Collections;
|
||||
|
||||
namespace System.Diagnostics
|
||||
{
|
||||
public class CorrelationManager
|
||||
{
|
||||
Guid activity;
|
||||
Stack op_stack = new Stack ();
|
||||
|
||||
internal CorrelationManager ()
|
||||
{
|
||||
}
|
||||
|
||||
public Guid ActivityId {
|
||||
get { return activity; }
|
||||
set { activity = value; }
|
||||
}
|
||||
|
||||
public Stack LogicalOperationStack {
|
||||
get { return op_stack; }
|
||||
}
|
||||
|
||||
public void StartLogicalOperation ()
|
||||
{
|
||||
StartLogicalOperation (Guid.NewGuid ());
|
||||
}
|
||||
|
||||
public void StartLogicalOperation (object operationId)
|
||||
{
|
||||
op_stack.Push (operationId);
|
||||
}
|
||||
|
||||
public void StopLogicalOperation ()
|
||||
{
|
||||
op_stack.Pop ();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,247 +0,0 @@
|
||||
//
|
||||
// System.Diagnostics.Debug.cs
|
||||
//
|
||||
// Authors:
|
||||
// Jonathan Pryor (jonpryor@vt.edu)
|
||||
//
|
||||
// Comments from John R. Hicks <angryjohn69@nc.rr.com> original implementation
|
||||
// can be found at: /mcs/docs/apidocs/xml/en/System.Diagnostics
|
||||
//
|
||||
// (C) 2002
|
||||
//
|
||||
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining
|
||||
// a copy of this software and associated documentation files (the
|
||||
// "Software"), to deal in the Software without restriction, including
|
||||
// without limitation the rights to use, copy, modify, merge, publish,
|
||||
// distribute, sublicense, and/or sell copies of the Software, and to
|
||||
// permit persons to whom the Software is furnished to do so, subject to
|
||||
// the following conditions:
|
||||
//
|
||||
// The above copyright notice and this permission notice shall be
|
||||
// included in all copies or substantial portions of the Software.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
||||
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
||||
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
||||
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
||||
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
//
|
||||
|
||||
using System;
|
||||
using System.Diagnostics;
|
||||
|
||||
namespace System.Diagnostics {
|
||||
|
||||
public static class Debug {
|
||||
|
||||
public static bool AutoFlush {
|
||||
get {return TraceImpl.AutoFlush;}
|
||||
set {TraceImpl.AutoFlush = value;}
|
||||
}
|
||||
|
||||
public static int IndentLevel {
|
||||
get {return TraceImpl.IndentLevel;}
|
||||
set {TraceImpl.IndentLevel = value;}
|
||||
}
|
||||
|
||||
public static int IndentSize {
|
||||
get {return TraceImpl.IndentSize;}
|
||||
set {TraceImpl.IndentSize = value;}
|
||||
}
|
||||
|
||||
public static TraceListenerCollection Listeners {
|
||||
get {return TraceImpl.Listeners;}
|
||||
}
|
||||
|
||||
[Conditional("DEBUG")]
|
||||
public static void Assert (bool condition)
|
||||
{
|
||||
TraceImpl.Assert (condition);
|
||||
}
|
||||
|
||||
[Conditional("DEBUG")]
|
||||
public static void Assert (bool condition, string message)
|
||||
{
|
||||
TraceImpl.Assert (condition, message);
|
||||
}
|
||||
|
||||
[Conditional("DEBUG")]
|
||||
public static void Assert (bool condition, string message,
|
||||
string detailMessage)
|
||||
{
|
||||
TraceImpl.Assert (condition, message, detailMessage);
|
||||
}
|
||||
|
||||
[Conditional ("DEBUG")]
|
||||
public static void Assert (bool condition, string message,
|
||||
string detailMessageFormat, params object [] args)
|
||||
{
|
||||
if (condition)
|
||||
// Return early to avoid the string formatting
|
||||
return;
|
||||
|
||||
TraceImpl.Assert (condition,
|
||||
message,
|
||||
string.Format (detailMessageFormat, args));
|
||||
}
|
||||
|
||||
[Conditional("DEBUG")]
|
||||
public static void Close ()
|
||||
{
|
||||
TraceImpl.Close ();
|
||||
}
|
||||
|
||||
[Conditional("DEBUG")]
|
||||
public static void Fail (string message)
|
||||
{
|
||||
TraceImpl.Fail (message);
|
||||
}
|
||||
|
||||
[Conditional("DEBUG")]
|
||||
public static void Fail (string message, string detailMessage)
|
||||
{
|
||||
TraceImpl.Fail (message, detailMessage);
|
||||
}
|
||||
|
||||
[Conditional("DEBUG")]
|
||||
public static void Flush ()
|
||||
{
|
||||
TraceImpl.Flush ();
|
||||
}
|
||||
|
||||
[Conditional("DEBUG")]
|
||||
public static void Indent ()
|
||||
{
|
||||
TraceImpl.Indent ();
|
||||
}
|
||||
|
||||
[Conditional("DEBUG")]
|
||||
public static void Unindent ()
|
||||
{
|
||||
TraceImpl.Unindent ();
|
||||
}
|
||||
|
||||
[Conditional("DEBUG")]
|
||||
public static void Write (object value)
|
||||
{
|
||||
TraceImpl.Write (value);
|
||||
}
|
||||
|
||||
[Conditional("DEBUG")]
|
||||
public static void Write (string message)
|
||||
{
|
||||
TraceImpl.Write (message);
|
||||
}
|
||||
|
||||
[Conditional("DEBUG")]
|
||||
public static void Write (object value, string category)
|
||||
{
|
||||
TraceImpl.Write (value, category);
|
||||
}
|
||||
|
||||
[Conditional("DEBUG")]
|
||||
public static void Write (string message, string category)
|
||||
{
|
||||
TraceImpl.Write (message, category);
|
||||
}
|
||||
|
||||
[Conditional("DEBUG")]
|
||||
public static void WriteIf (bool condition, object value)
|
||||
{
|
||||
TraceImpl.WriteIf (condition, value);
|
||||
}
|
||||
|
||||
[Conditional("DEBUG")]
|
||||
public static void WriteIf (bool condition, string message)
|
||||
{
|
||||
TraceImpl.WriteIf (condition, message);
|
||||
}
|
||||
|
||||
[Conditional("DEBUG")]
|
||||
public static void WriteIf (bool condition, object value,
|
||||
string category)
|
||||
{
|
||||
TraceImpl.WriteIf (condition, value, category);
|
||||
}
|
||||
|
||||
[Conditional("DEBUG")]
|
||||
public static void WriteIf (bool condition, string message,
|
||||
string category)
|
||||
{
|
||||
TraceImpl.WriteIf (condition, message, category);
|
||||
}
|
||||
|
||||
[Conditional("DEBUG")]
|
||||
public static void WriteLine (object value)
|
||||
{
|
||||
TraceImpl.WriteLine (value);
|
||||
}
|
||||
|
||||
[Conditional("DEBUG")]
|
||||
public static void WriteLine (string message)
|
||||
{
|
||||
TraceImpl.WriteLine (message);
|
||||
}
|
||||
|
||||
[Conditional("DEBUG")]
|
||||
public static void WriteLine (string format, params object [] args)
|
||||
{
|
||||
TraceImpl.WriteLine (string.Format (format, args));
|
||||
}
|
||||
|
||||
[Conditional("DEBUG")]
|
||||
public static void WriteLine (object value, string category)
|
||||
{
|
||||
TraceImpl.WriteLine (value, category);
|
||||
}
|
||||
|
||||
[Conditional("DEBUG")]
|
||||
public static void WriteLine (string message, string category)
|
||||
{
|
||||
TraceImpl.WriteLine (message, category);
|
||||
}
|
||||
|
||||
[Conditional("DEBUG")]
|
||||
public static void WriteLineIf (bool condition, object value)
|
||||
{
|
||||
TraceImpl.WriteLineIf (condition, value);
|
||||
}
|
||||
|
||||
[Conditional("DEBUG")]
|
||||
public static void WriteLineIf (bool condition, string message)
|
||||
{
|
||||
TraceImpl.WriteLineIf (condition, message);
|
||||
}
|
||||
|
||||
[Conditional("DEBUG")]
|
||||
public static void WriteLineIf (bool condition, object value,
|
||||
string category)
|
||||
{
|
||||
TraceImpl.WriteLineIf (condition, value, category);
|
||||
}
|
||||
|
||||
[Conditional("DEBUG")]
|
||||
public static void WriteLineIf (bool condition, string message,
|
||||
string category)
|
||||
{
|
||||
TraceImpl.WriteLineIf (condition, message, category);
|
||||
}
|
||||
|
||||
[Conditional("DEBUG")]
|
||||
public static void Print (string message)
|
||||
{
|
||||
TraceImpl.WriteLine (message);
|
||||
}
|
||||
|
||||
[Conditional("DEBUG")]
|
||||
public static void Print (string format, params Object[] args)
|
||||
{
|
||||
TraceImpl.WriteLine (String.Format (format, args));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,156 +0,0 @@
|
||||
//
|
||||
// DelimitedListTraceFilter.cs
|
||||
//
|
||||
// Author:
|
||||
// Atsushi Enomoto <atsushi@ximian.com>
|
||||
//
|
||||
// (C) 2007 Novell, Inc.
|
||||
//
|
||||
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining
|
||||
// a copy of this software and associated documentation files (the
|
||||
// "Software"), to deal in the Software without restriction, including
|
||||
// without limitation the rights to use, copy, modify, merge, publish,
|
||||
// distribute, sublicense, and/or sell copies of the Software, and to
|
||||
// permit persons to whom the Software is furnished to do so, subject to
|
||||
// the following conditions:
|
||||
//
|
||||
// The above copyright notice and this permission notice shall be
|
||||
// included in all copies or substantial portions of the Software.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
||||
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
||||
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
||||
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
||||
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
//
|
||||
|
||||
using System;
|
||||
using System.IO;
|
||||
using System.Collections;
|
||||
using System.Diagnostics;
|
||||
using System.Runtime.CompilerServices;
|
||||
using System.Runtime.InteropServices;
|
||||
using System.Text;
|
||||
|
||||
namespace System.Diagnostics
|
||||
{
|
||||
public class DelimitedListTraceListener : TextWriterTraceListener
|
||||
{
|
||||
public DelimitedListTraceListener (string fileName)
|
||||
: base (fileName)
|
||||
{
|
||||
}
|
||||
|
||||
public DelimitedListTraceListener (string fileName, string name)
|
||||
: base (fileName, name)
|
||||
{
|
||||
}
|
||||
|
||||
public DelimitedListTraceListener (Stream stream)
|
||||
: base (stream)
|
||||
{
|
||||
}
|
||||
|
||||
public DelimitedListTraceListener (Stream stream, string name)
|
||||
: base (stream, name)
|
||||
{
|
||||
}
|
||||
|
||||
public DelimitedListTraceListener (TextWriter writer)
|
||||
: base (writer)
|
||||
{
|
||||
}
|
||||
|
||||
public DelimitedListTraceListener (TextWriter writer, string name)
|
||||
: base (writer, name)
|
||||
{
|
||||
}
|
||||
|
||||
static readonly string [] attributes = new string [] {"delimiter"};
|
||||
string delimiter = ";";
|
||||
|
||||
public string Delimiter {
|
||||
get { return delimiter; }
|
||||
set {
|
||||
if (value == null)
|
||||
throw new ArgumentNullException ("value");
|
||||
delimiter = value;
|
||||
}
|
||||
}
|
||||
|
||||
protected internal override string [] GetSupportedAttributes ()
|
||||
{
|
||||
return attributes;
|
||||
}
|
||||
|
||||
public override void TraceData (TraceEventCache eventCache,
|
||||
string source, TraceEventType eventType,
|
||||
int id, object data)
|
||||
{
|
||||
TraceCore (eventCache, source, eventType, id, null, data);
|
||||
}
|
||||
|
||||
public override void TraceData (TraceEventCache eventCache,
|
||||
string source, TraceEventType eventType,
|
||||
int id, params object [] data)
|
||||
{
|
||||
TraceCore (eventCache, source, eventType, id, null, data);
|
||||
}
|
||||
|
||||
public override void TraceEvent (TraceEventCache eventCache,
|
||||
string source, TraceEventType eventType,
|
||||
int id, string message)
|
||||
{
|
||||
TraceCore (eventCache, source, eventType, id, message);
|
||||
}
|
||||
|
||||
public override void TraceEvent (TraceEventCache eventCache,
|
||||
string source, TraceEventType eventType,
|
||||
int id, string format, params object [] args)
|
||||
{
|
||||
TraceCore (eventCache, source, eventType, id, String.Format (format, args));
|
||||
}
|
||||
|
||||
void TraceCore (TraceEventCache c, string source, TraceEventType eventType, int id, string message, params object [] data)
|
||||
{
|
||||
// source, eventType, id, message?, data-comma-separated
|
||||
Write (String.Format ("{1}{0}{2}{0}{3}{0}{4}{0}{5}{0}{6}{0}{7}{0}{8}{0}{9}{0}{10}{0}{11}{12}",
|
||||
delimiter,
|
||||
source != null ? "\"" + source.Replace ("\"", "\"\"") + "\"": null,
|
||||
eventType,
|
||||
id,
|
||||
message != null ? "\"" + message.Replace ("\"", "\"\"") + "\"" : null,
|
||||
FormatData (data),
|
||||
IsTarget (c, TraceOptions.ProcessId) ? c.ProcessId.ToString () : null,
|
||||
IsTarget (c, TraceOptions.LogicalOperationStack) ? FormatArray (c.LogicalOperationStack, ", ") : null,
|
||||
IsTarget (c, TraceOptions.ThreadId) ? c.ThreadId : null,
|
||||
IsTarget (c, TraceOptions.DateTime) ? c.DateTime.ToString ("o") : null,
|
||||
IsTarget (c, TraceOptions.Timestamp) ? c.Timestamp.ToString () : null,
|
||||
IsTarget (c, TraceOptions.Callstack) ? c.Callstack : null,
|
||||
Environment.NewLine));
|
||||
}
|
||||
|
||||
bool IsTarget (TraceEventCache c, TraceOptions opt)
|
||||
{
|
||||
return c != null && (TraceOutputOptions & opt) != 0;
|
||||
}
|
||||
|
||||
string FormatData (object [] data)
|
||||
{
|
||||
if (data == null || data.Length == 0)
|
||||
return null;
|
||||
StringBuilder sb = new StringBuilder ();
|
||||
for (int i = 0; i < data.Length; i++) {
|
||||
if (data [i] != null)
|
||||
sb.Append ('"').Append (data [i].ToString ().Replace ("\"", "\"\"")).Append ('"');
|
||||
if (i + 1 < data.Length)
|
||||
sb.Append (',');
|
||||
}
|
||||
return sb.ToString ();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -42,6 +42,7 @@ using System.Xml;
|
||||
#endif
|
||||
namespace System.Diagnostics
|
||||
{
|
||||
/*
|
||||
// It handles following elements in <system.diagnostics> :
|
||||
// - <sharedListeners> [2.0]
|
||||
// - <sources>
|
||||
@@ -81,6 +82,8 @@ namespace System.Diagnostics
|
||||
}
|
||||
}
|
||||
}
|
||||
*/
|
||||
|
||||
#if (XML_DEP)
|
||||
[Obsolete ("This class is obsoleted")]
|
||||
public class DiagnosticsConfigurationHandler : IConfigurationSectionHandler
|
||||
@@ -305,7 +308,7 @@ namespace System.Diagnostics
|
||||
{
|
||||
TraceListenerCollection shared_listeners = d ["sharedListeners"] as TraceListenerCollection;
|
||||
if (shared_listeners == null) {
|
||||
shared_listeners = new TraceListenerCollection (false);
|
||||
shared_listeners = new TraceListenerCollection ();
|
||||
d ["sharedListeners"] = shared_listeners;
|
||||
}
|
||||
return shared_listeners;
|
||||
@@ -434,7 +437,8 @@ namespace System.Diagnostics
|
||||
"Listener '{0}' references a shared " +
|
||||
"listener and can only have a 'Name' " +
|
||||
"attribute.", name));
|
||||
listeners.Add (shared, configValues);
|
||||
shared.IndentSize = configValues.IndentSize;
|
||||
listeners.Add (shared);
|
||||
return;
|
||||
}
|
||||
#else
|
||||
@@ -501,7 +505,8 @@ namespace System.Diagnostics
|
||||
}
|
||||
#endif
|
||||
|
||||
listeners.Add (l, configValues);
|
||||
l.IndentSize = configValues.IndentSize;
|
||||
listeners.Add (l);
|
||||
}
|
||||
|
||||
private void RemoveTraceListener (string name)
|
||||
|
||||
@@ -1,80 +0,0 @@
|
||||
//
|
||||
// EventTypeFilter.cs
|
||||
//
|
||||
// Author:
|
||||
// Atsushi Enomoto <atsushi@ximian.com>
|
||||
//
|
||||
// (C) 2007 Novell, Inc.
|
||||
//
|
||||
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining
|
||||
// a copy of this software and associated documentation files (the
|
||||
// "Software"), to deal in the Software without restriction, including
|
||||
// without limitation the rights to use, copy, modify, merge, publish,
|
||||
// distribute, sublicense, and/or sell copies of the Software, and to
|
||||
// permit persons to whom the Software is furnished to do so, subject to
|
||||
// the following conditions:
|
||||
//
|
||||
// The above copyright notice and this permission notice shall be
|
||||
// included in all copies or substantial portions of the Software.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
||||
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
||||
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
||||
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
||||
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
//
|
||||
using System;
|
||||
using System.IO;
|
||||
using System.Collections;
|
||||
using System.Diagnostics;
|
||||
using System.Runtime.CompilerServices;
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
namespace System.Diagnostics
|
||||
{
|
||||
public class EventTypeFilter : TraceFilter
|
||||
{
|
||||
SourceLevels event_type;
|
||||
|
||||
public EventTypeFilter (SourceLevels eventType)
|
||||
{
|
||||
event_type = eventType;
|
||||
}
|
||||
|
||||
public SourceLevels EventType {
|
||||
get { return event_type; }
|
||||
set { event_type = value; }
|
||||
}
|
||||
|
||||
public override bool ShouldTrace (TraceEventCache cache,
|
||||
string source, TraceEventType eventType,
|
||||
int id, string formatOrMessage,
|
||||
object [] args, object data1,
|
||||
object [] data)
|
||||
{
|
||||
switch (eventType) {
|
||||
case TraceEventType.Critical:
|
||||
return (event_type & SourceLevels.Critical) != 0;
|
||||
case TraceEventType.Error:
|
||||
return (event_type & SourceLevels.Error) != 0;
|
||||
case TraceEventType.Information:
|
||||
return (event_type & SourceLevels.Information) != 0;
|
||||
case TraceEventType.Verbose:
|
||||
return (event_type & SourceLevels.Verbose) != 0;
|
||||
case TraceEventType.Warning:
|
||||
return (event_type & SourceLevels.Warning) != 0;
|
||||
case TraceEventType.Start:
|
||||
case TraceEventType.Stop:
|
||||
case TraceEventType.Suspend:
|
||||
case TraceEventType.Resume:
|
||||
case TraceEventType.Transfer:
|
||||
return (event_type & SourceLevels.ActivityTracing) != 0;
|
||||
}
|
||||
return event_type != SourceLevels.Off; // does it happen?
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -38,6 +38,7 @@ using System.ComponentModel;
|
||||
using System.ComponentModel.Design;
|
||||
using System.Runtime.CompilerServices;
|
||||
using System.Runtime.InteropServices;
|
||||
using System.Runtime.Remoting.Messaging;
|
||||
using System.Security.Permissions;
|
||||
using System.Collections.Generic;
|
||||
using System.Security;
|
||||
@@ -75,12 +76,14 @@ namespace System.Diagnostics {
|
||||
IntPtr process_handle;
|
||||
int pid;
|
||||
bool enableRaisingEvents;
|
||||
bool already_waiting;
|
||||
RegisteredWaitHandle exitWaitHandle;
|
||||
ISynchronizeInvoke synchronizingObject;
|
||||
EventHandler exited_event;
|
||||
IntPtr stdout_rd;
|
||||
IntPtr stderr_rd;
|
||||
|
||||
|
||||
object thisLock = new Object ();
|
||||
|
||||
/* Private constructor called from other methods */
|
||||
private Process(IntPtr handle, int id) {
|
||||
process_handle=handle;
|
||||
@@ -102,12 +105,30 @@ namespace System.Diagnostics {
|
||||
|
||||
void StartExitCallbackIfNeeded ()
|
||||
{
|
||||
bool start = (!already_waiting && enableRaisingEvents && exited_event != null);
|
||||
if (start && process_handle != IntPtr.Zero) {
|
||||
WaitOrTimerCallback cb = new WaitOrTimerCallback (CBOnExit);
|
||||
ProcessWaitHandle h = new ProcessWaitHandle (process_handle);
|
||||
ThreadPool.RegisterWaitForSingleObject (h, cb, this, -1, true);
|
||||
already_waiting = true;
|
||||
lock (thisLock) {
|
||||
bool start = (exitWaitHandle == null && enableRaisingEvents && exited_event != null);
|
||||
if (start && process_handle != IntPtr.Zero) {
|
||||
WaitOrTimerCallback cb = new WaitOrTimerCallback (CBOnExit);
|
||||
ProcessWaitHandle h = new ProcessWaitHandle (process_handle);
|
||||
exitWaitHandle = ThreadPool.RegisterWaitForSingleObject (h, cb, this, -1, true);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void UnregisterExitCallback ()
|
||||
{
|
||||
lock (thisLock) {
|
||||
if (exitWaitHandle != null) {
|
||||
exitWaitHandle.Unregister (null);
|
||||
exitWaitHandle = null;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
bool IsExitCallbackPending ()
|
||||
{
|
||||
lock (thisLock) {
|
||||
return exitWaitHandle != null;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1263,7 +1284,13 @@ namespace System.Diagnostics {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return WaitForExit_internal (process_handle, ms);
|
||||
|
||||
bool exited = WaitForExit_internal (process_handle, ms);
|
||||
|
||||
if (exited)
|
||||
OnExited ();
|
||||
|
||||
return exited;
|
||||
}
|
||||
|
||||
/* Waits up to ms milliseconds for process 'handle' to
|
||||
@@ -1321,7 +1348,7 @@ namespace System.Diagnostics {
|
||||
}
|
||||
|
||||
[StructLayout (LayoutKind.Sequential)]
|
||||
sealed class ProcessAsyncReader
|
||||
sealed class ProcessAsyncReader : IThreadPoolWorkItem
|
||||
{
|
||||
/*
|
||||
The following fields match those of SocketAsyncResult.
|
||||
@@ -1358,7 +1385,7 @@ namespace System.Diagnostics {
|
||||
bool err_out; // true -> stdout, false -> stderr
|
||||
internal int error;
|
||||
public int operation = 8; // MAGIC NUMBER: see Socket.cs:AsyncOperation
|
||||
public object ares;
|
||||
public AsyncResult async_result;
|
||||
public int EndCalled;
|
||||
|
||||
// These fields are not in SocketAsyncResult
|
||||
@@ -1460,8 +1487,21 @@ namespace System.Diagnostics {
|
||||
}
|
||||
|
||||
public void Close () {
|
||||
RemoveFromIOThreadPool (handle);
|
||||
stream.Close ();
|
||||
}
|
||||
|
||||
[MethodImplAttribute(MethodImplOptions.InternalCall)]
|
||||
extern static void RemoveFromIOThreadPool (IntPtr handle);
|
||||
|
||||
void IThreadPoolWorkItem.ExecuteWorkItem()
|
||||
{
|
||||
async_result.Invoke ();
|
||||
}
|
||||
|
||||
void IThreadPoolWorkItem.MarkAborted(ThreadAbortException tae)
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
AsyncModes async_mode;
|
||||
@@ -1566,7 +1606,7 @@ namespace System.Diagnostics {
|
||||
// dispose all managed resources.
|
||||
if(disposing) {
|
||||
// Do stuff here
|
||||
lock (this) {
|
||||
lock (thisLock) {
|
||||
/* These have open FileStreams on the pipes we are about to close */
|
||||
if (async_output != null)
|
||||
async_output.Close ();
|
||||
@@ -1593,7 +1633,7 @@ namespace System.Diagnostics {
|
||||
|
||||
// Release unmanaged resources
|
||||
|
||||
lock(this) {
|
||||
lock (thisLock) {
|
||||
if(process_handle!=IntPtr.Zero) {
|
||||
Process_free_internal(process_handle);
|
||||
process_handle=IntPtr.Zero;
|
||||
@@ -1611,15 +1651,31 @@ namespace System.Diagnostics {
|
||||
static void CBOnExit (object state, bool unused)
|
||||
{
|
||||
Process p = (Process) state;
|
||||
p.already_waiting = false;
|
||||
|
||||
if (!p.IsExitCallbackPending ())
|
||||
return;
|
||||
|
||||
if (!p.HasExited) {
|
||||
p.UnregisterExitCallback ();
|
||||
p.StartExitCallbackIfNeeded ();
|
||||
return;
|
||||
}
|
||||
|
||||
p.OnExited ();
|
||||
}
|
||||
|
||||
int on_exited_called = 0;
|
||||
|
||||
protected void OnExited()
|
||||
{
|
||||
if (exited_event == null)
|
||||
return;
|
||||
|
||||
if (on_exited_called != 0 || Interlocked.CompareExchange (ref on_exited_called, 1, 0) != 0)
|
||||
return;
|
||||
|
||||
UnregisterExitCallback ();
|
||||
|
||||
if (synchronizingObject == null) {
|
||||
foreach (EventHandler d in exited_event.GetInvocationList ()) {
|
||||
try {
|
||||
|
||||
@@ -1,68 +0,0 @@
|
||||
//
|
||||
// SourceFilter.cs
|
||||
//
|
||||
// Author:
|
||||
// Atsushi Enomoto <atsushi@ximian.com>
|
||||
//
|
||||
// (C) 2007 Novell, Inc.
|
||||
//
|
||||
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining
|
||||
// a copy of this software and associated documentation files (the
|
||||
// "Software"), to deal in the Software without restriction, including
|
||||
// without limitation the rights to use, copy, modify, merge, publish,
|
||||
// distribute, sublicense, and/or sell copies of the Software, and to
|
||||
// permit persons to whom the Software is furnished to do so, subject to
|
||||
// the following conditions:
|
||||
//
|
||||
// The above copyright notice and this permission notice shall be
|
||||
// included in all copies or substantial portions of the Software.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
||||
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
||||
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
||||
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
||||
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
//
|
||||
using System;
|
||||
using System.IO;
|
||||
using System.Collections;
|
||||
using System.Diagnostics;
|
||||
using System.Runtime.CompilerServices;
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
namespace System.Diagnostics
|
||||
{
|
||||
public class SourceFilter : TraceFilter
|
||||
{
|
||||
string source;
|
||||
|
||||
public SourceFilter (string source)
|
||||
{
|
||||
if (source == null)
|
||||
throw new ArgumentNullException ("source");
|
||||
this.source = source;
|
||||
}
|
||||
|
||||
public string Source {
|
||||
get { return source; }
|
||||
set {
|
||||
if (source == null)
|
||||
throw new ArgumentNullException ("value");
|
||||
source = value;
|
||||
}
|
||||
}
|
||||
|
||||
public override bool ShouldTrace (TraceEventCache cache,
|
||||
string source, TraceEventType eventType,
|
||||
int id, string formatOrMessage,
|
||||
object [] args, object data1,
|
||||
object [] data)
|
||||
{
|
||||
return source == this.source;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,51 +0,0 @@
|
||||
//
|
||||
// SourceLevels.cs
|
||||
//
|
||||
// Author:
|
||||
// Atsushi Enomoto <atsushi@ximian.com>
|
||||
//
|
||||
// Copyright (C) 2007 Novell, Inc.
|
||||
//
|
||||
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining
|
||||
// a copy of this software and associated documentation files (the
|
||||
// "Software"), to deal in the Software without restriction, including
|
||||
// without limitation the rights to use, copy, modify, merge, publish,
|
||||
// distribute, sublicense, and/or sell copies of the Software, and to
|
||||
// permit persons to whom the Software is furnished to do so, subject to
|
||||
// the following conditions:
|
||||
//
|
||||
// The above copyright notice and this permission notice shall be
|
||||
// included in all copies or substantial portions of the Software.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
||||
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
||||
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
||||
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
||||
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
//
|
||||
|
||||
|
||||
using System;
|
||||
using System.ComponentModel;
|
||||
|
||||
namespace System.Diagnostics
|
||||
{
|
||||
[Flags]
|
||||
public enum SourceLevels
|
||||
{
|
||||
Off = 0,
|
||||
Critical = 1,
|
||||
Error = 3,
|
||||
Warning = 7,
|
||||
Information = 15,
|
||||
Verbose = 31,
|
||||
[EditorBrowsable (EditorBrowsableState.Advanced)]
|
||||
ActivityTracing = 0xFF00,
|
||||
All = -1,
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,85 +0,0 @@
|
||||
//
|
||||
// SourceSwitch.cs
|
||||
//
|
||||
// Author:
|
||||
// Atsushi Enomoto <atsushi@ximian.com>
|
||||
//
|
||||
// Copyright (C) 2007 Novell, Inc.
|
||||
//
|
||||
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining
|
||||
// a copy of this software and associated documentation files (the
|
||||
// "Software"), to deal in the Software without restriction, including
|
||||
// without limitation the rights to use, copy, modify, merge, publish,
|
||||
// distribute, sublicense, and/or sell copies of the Software, and to
|
||||
// permit persons to whom the Software is furnished to do so, subject to
|
||||
// the following conditions:
|
||||
//
|
||||
// The above copyright notice and this permission notice shall be
|
||||
// included in all copies or substantial portions of the Software.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
||||
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
||||
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
||||
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
||||
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
//
|
||||
|
||||
|
||||
using System;
|
||||
|
||||
namespace System.Diagnostics
|
||||
{
|
||||
public class SourceSwitch : Switch
|
||||
{
|
||||
// FIXME: better explanation.
|
||||
const string description = "Source switch.";
|
||||
|
||||
public SourceSwitch (string displayName)
|
||||
: this (displayName, null)
|
||||
{
|
||||
}
|
||||
|
||||
public SourceSwitch (string displayName, string defaultSwitchValue)
|
||||
: base (displayName, description, defaultSwitchValue)
|
||||
{
|
||||
}
|
||||
|
||||
public SourceLevels Level {
|
||||
get { return (SourceLevels) SwitchSetting; }
|
||||
set {
|
||||
SwitchSetting = (int) value;
|
||||
}
|
||||
}
|
||||
|
||||
public bool ShouldTrace (TraceEventType eventType)
|
||||
{
|
||||
switch (eventType) {
|
||||
case TraceEventType.Critical:
|
||||
case TraceEventType.Error:
|
||||
case TraceEventType.Warning:
|
||||
case TraceEventType.Information:
|
||||
case TraceEventType.Verbose:
|
||||
return (Level & (SourceLevels)eventType) != 0;
|
||||
case TraceEventType.Start:
|
||||
case TraceEventType.Stop:
|
||||
case TraceEventType.Suspend:
|
||||
case TraceEventType.Resume:
|
||||
case TraceEventType.Transfer:
|
||||
default:
|
||||
return (Level & SourceLevels.ActivityTracing) != 0;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
protected override void OnValueChanged ()
|
||||
{
|
||||
SwitchSetting = (int) Enum.Parse (typeof (SourceLevels),
|
||||
Value, true);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,172 +0,0 @@
|
||||
//
|
||||
// System.Diagnostics.Switch.cs
|
||||
//
|
||||
// Comments from John R. Hicks <angryjohn69@nc.rr.com> original implementation
|
||||
// can be found at: /mcs/docs/apidocs/xml/en/System.Diagnostics
|
||||
//
|
||||
// Author:
|
||||
// John R. Hicks (angryjohn69@nc.rr.com)
|
||||
// Jonathan Pryor (jonpryor@vt.edu)
|
||||
//
|
||||
// (C) 2001-2002
|
||||
//
|
||||
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining
|
||||
// a copy of this software and associated documentation files (the
|
||||
// "Software"), to deal in the Software without restriction, including
|
||||
// without limitation the rights to use, copy, modify, merge, publish,
|
||||
// distribute, sublicense, and/or sell copies of the Software, and to
|
||||
// permit persons to whom the Software is furnished to do so, subject to
|
||||
// the following conditions:
|
||||
//
|
||||
// The above copyright notice and this permission notice shall be
|
||||
// included in all copies or substantial portions of the Software.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
||||
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
||||
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
||||
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
||||
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
//
|
||||
|
||||
using System.Collections;
|
||||
using System.Collections.Specialized;
|
||||
#if CONFIGURATION_DEP
|
||||
using System.Configuration;
|
||||
#endif
|
||||
|
||||
namespace System.Diagnostics
|
||||
{
|
||||
public abstract class Switch
|
||||
{
|
||||
private string name;
|
||||
private string description;
|
||||
private int switchSetting;
|
||||
private string value;
|
||||
private string defaultSwitchValue;
|
||||
// MS Behavior is that (quoting from MSDN for OnSwitchSettingChanged()):
|
||||
// "...It is invoked the first time a switch reads its value from the
|
||||
// configuration file..."
|
||||
// The docs + testing implies two things:
|
||||
// 1. The value of the switch is not read in from the constructor
|
||||
// 2. The value is instead read in on the first time get_SwitchSetting is
|
||||
// invoked
|
||||
// Assuming that OnSwitchSettingChanged() is invoked on a .config file
|
||||
// read and on all changes
|
||||
//
|
||||
// Thus, we need to keep track of whether or not switchSetting has been
|
||||
// initialized. Using `switchSetting=-1' seems logical, but if someone
|
||||
// actually wants to use -1 as a switch value that would cause problems.
|
||||
private bool initialized;
|
||||
|
||||
protected Switch(string displayName, string description)
|
||||
{
|
||||
this.name = displayName ?? string.Empty;
|
||||
this.description = description ?? string.Empty;
|
||||
}
|
||||
|
||||
protected Switch(string displayName, string description, string defaultSwitchValue)
|
||||
: this (displayName, description)
|
||||
{
|
||||
this.defaultSwitchValue = defaultSwitchValue;
|
||||
}
|
||||
|
||||
public string Description {
|
||||
get {return description;}
|
||||
}
|
||||
|
||||
public string DisplayName {
|
||||
get {return name;}
|
||||
}
|
||||
|
||||
protected int SwitchSetting {
|
||||
get {
|
||||
if (!initialized) {
|
||||
initialized = true;
|
||||
GetConfigFileSetting ();
|
||||
OnSwitchSettingChanged ();
|
||||
}
|
||||
return switchSetting;
|
||||
}
|
||||
set {
|
||||
if(switchSetting != value) {
|
||||
switchSetting = value;
|
||||
OnSwitchSettingChanged();
|
||||
}
|
||||
initialized = true;
|
||||
}
|
||||
}
|
||||
|
||||
StringDictionary attributes = new StringDictionary ();
|
||||
|
||||
#if XML_DEP
|
||||
[System.Xml.Serialization.XmlIgnore]
|
||||
#endif
|
||||
public StringDictionary Attributes {
|
||||
get { return attributes; }
|
||||
}
|
||||
|
||||
protected string Value {
|
||||
get { return value; }
|
||||
set {
|
||||
this.value = value;
|
||||
#if CONFIGURATION_DEP
|
||||
try {
|
||||
OnValueChanged ();
|
||||
} catch (Exception ex) {
|
||||
string msg = string.Format ("The config "
|
||||
+ "value for Switch '{0}' was "
|
||||
+ "invalid.", DisplayName);
|
||||
|
||||
throw new ConfigurationErrorsException (
|
||||
msg, ex);
|
||||
}
|
||||
#else
|
||||
OnValueChanged ();
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
protected internal virtual string [] GetSupportedAttributes ()
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
protected virtual void OnValueChanged ()
|
||||
{
|
||||
}
|
||||
|
||||
private void GetConfigFileSetting ()
|
||||
{
|
||||
#if !MOBILE
|
||||
IDictionary d = (IDictionary) DiagnosticsConfiguration.Settings ["switches"];
|
||||
|
||||
// Load up the specified switch
|
||||
if (d != null) {
|
||||
if (d.Contains (name)) {
|
||||
#if CONFIGURATION_DEP
|
||||
Value = d [name] as string;
|
||||
#else
|
||||
switchSetting = (int) d [name];
|
||||
#endif
|
||||
return;
|
||||
}
|
||||
}
|
||||
#endif // !MOBILE
|
||||
|
||||
if (defaultSwitchValue != null) {
|
||||
value = defaultSwitchValue;
|
||||
OnValueChanged ();
|
||||
}
|
||||
}
|
||||
|
||||
protected virtual void OnSwitchSettingChanged()
|
||||
{
|
||||
// Do nothing. This is merely provided for derived classes to know when
|
||||
// the value of SwitchSetting has changed.
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,95 +0,0 @@
|
||||
//
|
||||
// SwitchAttribute.cs
|
||||
//
|
||||
// Author:
|
||||
// Atsushi Enomoto <atsushi@ximian.com>
|
||||
//
|
||||
// (C) 2007 Novell, Inc.
|
||||
//
|
||||
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining
|
||||
// a copy of this software and associated documentation files (the
|
||||
// "Software"), to deal in the Software without restriction, including
|
||||
// without limitation the rights to use, copy, modify, merge, publish,
|
||||
// distribute, sublicense, and/or sell copies of the Software, and to
|
||||
// permit persons to whom the Software is furnished to do so, subject to
|
||||
// the following conditions:
|
||||
//
|
||||
// The above copyright notice and this permission notice shall be
|
||||
// included in all copies or substantial portions of the Software.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
||||
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
||||
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
||||
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
||||
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
//
|
||||
using System;
|
||||
using System.Diagnostics;
|
||||
using System.Reflection;
|
||||
|
||||
namespace System.Diagnostics
|
||||
{
|
||||
[MonoLimitation ("This attribute is not considered in trace support.")]
|
||||
[AttributeUsageAttribute (
|
||||
AttributeTargets.Assembly |
|
||||
AttributeTargets.Class |
|
||||
AttributeTargets.Constructor |
|
||||
AttributeTargets.Method |
|
||||
AttributeTargets.Property |
|
||||
AttributeTargets.Event)]
|
||||
public sealed class SwitchAttribute : Attribute
|
||||
{
|
||||
public static SwitchAttribute [] GetAll (Assembly assembly)
|
||||
{
|
||||
object [] atts = assembly.GetCustomAttributes (typeof (SwitchAttribute), false);
|
||||
SwitchAttribute [] ret = new SwitchAttribute [atts.Length];
|
||||
for (int i = 0; i < atts.Length; i++)
|
||||
ret [i] = (SwitchAttribute) atts [i];
|
||||
return ret;
|
||||
}
|
||||
|
||||
public SwitchAttribute (string switchName, Type switchType)
|
||||
{
|
||||
if (switchName == null)
|
||||
throw new ArgumentNullException ("switchName");
|
||||
if (switchType == null)
|
||||
throw new ArgumentNullException ("switchType");
|
||||
name = switchName;
|
||||
type = switchType;
|
||||
}
|
||||
|
||||
string name, desc = String.Empty;
|
||||
Type type;
|
||||
|
||||
public string SwitchName {
|
||||
get { return name; }
|
||||
set {
|
||||
if (name == null)
|
||||
throw new ArgumentNullException ("value");
|
||||
name = value;
|
||||
}
|
||||
}
|
||||
|
||||
public string SwitchDescription {
|
||||
get { return desc; }
|
||||
set {
|
||||
if (desc == null)
|
||||
throw new ArgumentNullException ("value");
|
||||
desc = value;
|
||||
}
|
||||
}
|
||||
|
||||
public Type SwitchType {
|
||||
get { return type; }
|
||||
set {
|
||||
if (type == null)
|
||||
throw new ArgumentNullException ("value");
|
||||
type = value;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,61 +0,0 @@
|
||||
//
|
||||
// SwitchLevelAttribute.cs
|
||||
//
|
||||
// Author:
|
||||
// Atsushi Enomoto <atsushi@ximian.com>
|
||||
//
|
||||
// (C) 2007 Novell, Inc.
|
||||
//
|
||||
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining
|
||||
// a copy of this software and associated documentation files (the
|
||||
// "Software"), to deal in the Software without restriction, including
|
||||
// without limitation the rights to use, copy, modify, merge, publish,
|
||||
// distribute, sublicense, and/or sell copies of the Software, and to
|
||||
// permit persons to whom the Software is furnished to do so, subject to
|
||||
// the following conditions:
|
||||
//
|
||||
// The above copyright notice and this permission notice shall be
|
||||
// included in all copies or substantial portions of the Software.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
||||
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
||||
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
||||
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
||||
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
//
|
||||
using System;
|
||||
using System.IO;
|
||||
using System.Collections;
|
||||
using System.Diagnostics;
|
||||
using System.Runtime.CompilerServices;
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
namespace System.Diagnostics
|
||||
{
|
||||
[MonoLimitation ("This attribute is not considered in trace support.")]
|
||||
[AttributeUsageAttribute (AttributeTargets.Class)]
|
||||
public sealed class SwitchLevelAttribute : Attribute
|
||||
{
|
||||
Type type;
|
||||
|
||||
public SwitchLevelAttribute (Type switchLevelType)
|
||||
{
|
||||
if (switchLevelType == null)
|
||||
throw new ArgumentNullException ("switchLevelType");
|
||||
this.type = switchLevelType;
|
||||
}
|
||||
|
||||
public Type SwitchLevelType {
|
||||
get { return type; }
|
||||
set {
|
||||
if (value == null)
|
||||
throw new ArgumentNullException ("value");
|
||||
type = value;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,135 +0,0 @@
|
||||
//
|
||||
// System.Diagnostics.TextWriterTraceListener.cs
|
||||
//
|
||||
// Comments from John R. Hicks <angryjohn69@nc.rr.com> original implementation
|
||||
// can be found at: /mcs/docs/apidocs/xml/en/System.Diagnostics
|
||||
//
|
||||
// Authors:
|
||||
// Jonathan Pryor (jonpryor@vt.edu)
|
||||
//
|
||||
// (C) 2002 Jonathan Pryor
|
||||
//
|
||||
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining
|
||||
// a copy of this software and associated documentation files (the
|
||||
// "Software"), to deal in the Software without restriction, including
|
||||
// without limitation the rights to use, copy, modify, merge, publish,
|
||||
// distribute, sublicense, and/or sell copies of the Software, and to
|
||||
// permit persons to whom the Software is furnished to do so, subject to
|
||||
// the following conditions:
|
||||
//
|
||||
// The above copyright notice and this permission notice shall be
|
||||
// included in all copies or substantial portions of the Software.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
||||
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
||||
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
||||
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
||||
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
//
|
||||
|
||||
using System;
|
||||
using System.IO;
|
||||
using System.Diagnostics;
|
||||
|
||||
namespace System.Diagnostics {
|
||||
|
||||
public class TextWriterTraceListener : TraceListener {
|
||||
|
||||
private TextWriter writer;
|
||||
|
||||
public TextWriterTraceListener () : base ("TextWriter")
|
||||
{
|
||||
}
|
||||
|
||||
public TextWriterTraceListener (Stream stream)
|
||||
: this (stream, "")
|
||||
{
|
||||
}
|
||||
|
||||
public TextWriterTraceListener (string fileName)
|
||||
: this (fileName, "")
|
||||
{
|
||||
}
|
||||
|
||||
public TextWriterTraceListener (TextWriter writer)
|
||||
: this (writer, "")
|
||||
{
|
||||
}
|
||||
|
||||
public TextWriterTraceListener (Stream stream, string name)
|
||||
: base (name != null ? name : "")
|
||||
{
|
||||
if (stream == null)
|
||||
throw new ArgumentNullException ("stream");
|
||||
writer = new StreamWriter (stream);
|
||||
}
|
||||
|
||||
public TextWriterTraceListener (string fileName, string name)
|
||||
: base (name != null ? name : "")
|
||||
{
|
||||
if (fileName == null)
|
||||
throw new ArgumentNullException ("fileName");
|
||||
writer = new StreamWriter (new FileStream (fileName, FileMode.Append, FileAccess.Write, FileShare.ReadWrite));
|
||||
}
|
||||
|
||||
public TextWriterTraceListener (TextWriter writer, string name)
|
||||
: base (name != null ? name : "")
|
||||
{
|
||||
if (writer == null)
|
||||
throw new ArgumentNullException ("writer");
|
||||
this.writer = writer;
|
||||
}
|
||||
|
||||
public TextWriter Writer {
|
||||
get {return writer;}
|
||||
set {writer = value;}
|
||||
}
|
||||
|
||||
public override void Close ()
|
||||
{
|
||||
if (writer != null) {
|
||||
writer.Flush ();
|
||||
writer.Close ();
|
||||
writer = null;
|
||||
}
|
||||
}
|
||||
|
||||
protected override void Dispose (bool disposing)
|
||||
{
|
||||
if (disposing)
|
||||
Close ();
|
||||
|
||||
base.Dispose (disposing);
|
||||
}
|
||||
|
||||
public override void Flush ()
|
||||
{
|
||||
if (writer != null)
|
||||
writer.Flush ();
|
||||
}
|
||||
|
||||
public override void Write (string message)
|
||||
{
|
||||
if (writer != null) {
|
||||
if (NeedIndent)
|
||||
WriteIndent ();
|
||||
writer.Write (message);
|
||||
}
|
||||
}
|
||||
|
||||
public override void WriteLine (string message)
|
||||
{
|
||||
if (writer != null) {
|
||||
if (NeedIndent)
|
||||
WriteIndent ();
|
||||
writer.WriteLine (message);
|
||||
NeedIndent = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,276 +0,0 @@
|
||||
//
|
||||
// System.Diagnostics.Trace.cs
|
||||
//
|
||||
// Authors:
|
||||
// Jonathan Pryor (jonpryor@vt.edu)
|
||||
//
|
||||
// Comments from John R. Hicks <angryjohn69@nc.rr.com> original implementation
|
||||
// can be found at: /mcs/docs/apidocs/xml/en/System.Diagnostics
|
||||
//
|
||||
// (C) 2002
|
||||
//
|
||||
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining
|
||||
// a copy of this software and associated documentation files (the
|
||||
// "Software"), to deal in the Software without restriction, including
|
||||
// without limitation the rights to use, copy, modify, merge, publish,
|
||||
// distribute, sublicense, and/or sell copies of the Software, and to
|
||||
// permit persons to whom the Software is furnished to do so, subject to
|
||||
// the following conditions:
|
||||
//
|
||||
// The above copyright notice and this permission notice shall be
|
||||
// included in all copies or substantial portions of the Software.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
||||
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
||||
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
||||
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
||||
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
//
|
||||
|
||||
using System;
|
||||
using System.Diagnostics;
|
||||
using System.Reflection;
|
||||
|
||||
namespace System.Diagnostics {
|
||||
|
||||
public sealed class Trace {
|
||||
|
||||
private Trace () {}
|
||||
|
||||
[MonoNotSupported ("")]
|
||||
public static void Refresh ()
|
||||
{
|
||||
throw new NotImplementedException ();
|
||||
}
|
||||
|
||||
public static bool AutoFlush {
|
||||
get {return TraceImpl.AutoFlush;}
|
||||
set {TraceImpl.AutoFlush = value;}
|
||||
}
|
||||
|
||||
public static int IndentLevel {
|
||||
get {return TraceImpl.IndentLevel;}
|
||||
set {TraceImpl.IndentLevel = value;}
|
||||
}
|
||||
|
||||
public static int IndentSize {
|
||||
get {return TraceImpl.IndentSize;}
|
||||
set {TraceImpl.IndentSize = value;}
|
||||
}
|
||||
|
||||
public static TraceListenerCollection Listeners {
|
||||
get {return TraceImpl.Listeners;}
|
||||
}
|
||||
|
||||
public static CorrelationManager CorrelationManager {
|
||||
get { return TraceImpl.CorrelationManager; }
|
||||
}
|
||||
|
||||
public static bool UseGlobalLock {
|
||||
get { return TraceImpl.UseGlobalLock; }
|
||||
set { TraceImpl.UseGlobalLock = value; }
|
||||
}
|
||||
|
||||
[Conditional("TRACE")]
|
||||
public static void Assert (bool condition)
|
||||
{
|
||||
TraceImpl.Assert (condition);
|
||||
}
|
||||
|
||||
[Conditional("TRACE")]
|
||||
public static void Assert (bool condition, string message)
|
||||
{
|
||||
TraceImpl.Assert (condition, message);
|
||||
}
|
||||
|
||||
[Conditional("TRACE")]
|
||||
public static void Assert (bool condition, string message,
|
||||
string detailMessage)
|
||||
{
|
||||
TraceImpl.Assert (condition, message, detailMessage);
|
||||
}
|
||||
|
||||
[Conditional("TRACE")]
|
||||
public static void Close ()
|
||||
{
|
||||
TraceImpl.Close ();
|
||||
}
|
||||
|
||||
[Conditional("TRACE")]
|
||||
public static void Fail (string message)
|
||||
{
|
||||
TraceImpl.Fail (message);
|
||||
}
|
||||
|
||||
[Conditional("TRACE")]
|
||||
public static void Fail (string message, string detailMessage)
|
||||
{
|
||||
TraceImpl.Fail (message, detailMessage);
|
||||
}
|
||||
|
||||
[Conditional("TRACE")]
|
||||
public static void Flush ()
|
||||
{
|
||||
TraceImpl.Flush ();
|
||||
}
|
||||
|
||||
[Conditional("TRACE")]
|
||||
public static void Indent ()
|
||||
{
|
||||
TraceImpl.Indent ();
|
||||
}
|
||||
|
||||
[Conditional("TRACE")]
|
||||
public static void Unindent ()
|
||||
{
|
||||
TraceImpl.Unindent ();
|
||||
}
|
||||
|
||||
[Conditional("TRACE")]
|
||||
public static void Write (object value)
|
||||
{
|
||||
TraceImpl.Write (value);
|
||||
}
|
||||
|
||||
[Conditional("TRACE")]
|
||||
public static void Write (string message)
|
||||
{
|
||||
TraceImpl.Write (message);
|
||||
}
|
||||
|
||||
[Conditional("TRACE")]
|
||||
public static void Write (object value, string category)
|
||||
{
|
||||
TraceImpl.Write (value, category);
|
||||
}
|
||||
|
||||
[Conditional("TRACE")]
|
||||
public static void Write (string message, string category)
|
||||
{
|
||||
TraceImpl.Write (message, category);
|
||||
}
|
||||
|
||||
[Conditional("TRACE")]
|
||||
public static void WriteIf (bool condition, object value)
|
||||
{
|
||||
TraceImpl.WriteIf (condition, value);
|
||||
}
|
||||
|
||||
[Conditional("TRACE")]
|
||||
public static void WriteIf (bool condition, string message)
|
||||
{
|
||||
TraceImpl.WriteIf (condition, message);
|
||||
}
|
||||
|
||||
[Conditional("TRACE")]
|
||||
public static void WriteIf (bool condition, object value,
|
||||
string category)
|
||||
{
|
||||
TraceImpl.WriteIf (condition, value, category);
|
||||
}
|
||||
|
||||
[Conditional("TRACE")]
|
||||
public static void WriteIf (bool condition, string message,
|
||||
string category)
|
||||
{
|
||||
TraceImpl.WriteIf (condition, message, category);
|
||||
}
|
||||
|
||||
[Conditional("TRACE")]
|
||||
public static void WriteLine (object value)
|
||||
{
|
||||
TraceImpl.WriteLine (value);
|
||||
}
|
||||
|
||||
[Conditional("TRACE")]
|
||||
public static void WriteLine (string message)
|
||||
{
|
||||
TraceImpl.WriteLine (message);
|
||||
}
|
||||
|
||||
[Conditional("TRACE")]
|
||||
public static void WriteLine (object value, string category)
|
||||
{
|
||||
TraceImpl.WriteLine (value, category);
|
||||
}
|
||||
|
||||
[Conditional("TRACE")]
|
||||
public static void WriteLine (string message, string category)
|
||||
{
|
||||
TraceImpl.WriteLine (message, category);
|
||||
}
|
||||
|
||||
[Conditional("TRACE")]
|
||||
public static void WriteLineIf (bool condition, object value)
|
||||
{
|
||||
TraceImpl.WriteLineIf (condition, value);
|
||||
}
|
||||
|
||||
[Conditional("TRACE")]
|
||||
public static void WriteLineIf (bool condition, string message)
|
||||
{
|
||||
TraceImpl.WriteLineIf (condition, message);
|
||||
}
|
||||
|
||||
[Conditional("TRACE")]
|
||||
public static void WriteLineIf (bool condition, object value,
|
||||
string category)
|
||||
{
|
||||
TraceImpl.WriteLineIf (condition, value, category);
|
||||
}
|
||||
|
||||
[Conditional("TRACE")]
|
||||
public static void WriteLineIf (bool condition, string message,
|
||||
string category)
|
||||
{
|
||||
TraceImpl.WriteLineIf (condition, message, category);
|
||||
}
|
||||
|
||||
static void DoTrace (string kind, Assembly report, string message)
|
||||
{
|
||||
TraceImpl.WriteLine (String.Format ("{0} {1} : 0 : {2}", report.Location, kind, message));
|
||||
}
|
||||
|
||||
[Conditional("TRACE")]
|
||||
public static void TraceError (string message)
|
||||
{
|
||||
DoTrace ("Error", Assembly.GetCallingAssembly (), message);
|
||||
}
|
||||
|
||||
[Conditional("TRACE")]
|
||||
public static void TraceError (string message, params object [] args)
|
||||
{
|
||||
DoTrace ("Error", Assembly.GetCallingAssembly (), String.Format (message, args));
|
||||
}
|
||||
|
||||
[Conditional("TRACE")]
|
||||
public static void TraceInformation (string message)
|
||||
{
|
||||
DoTrace ("Information", Assembly.GetCallingAssembly (), message);
|
||||
}
|
||||
|
||||
[Conditional("TRACE")]
|
||||
public static void TraceInformation (string message, params object [] args)
|
||||
{
|
||||
DoTrace ("Information", Assembly.GetCallingAssembly (), String.Format (message, args));
|
||||
}
|
||||
|
||||
[Conditional("TRACE")]
|
||||
public static void TraceWarning (string message)
|
||||
{
|
||||
DoTrace ("Warning", Assembly.GetCallingAssembly (), message);
|
||||
}
|
||||
|
||||
[Conditional("TRACE")]
|
||||
public static void TraceWarning (string message, params object [] args)
|
||||
{
|
||||
DoTrace ("Warning", Assembly.GetCallingAssembly (), String.Format (message, args));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1,80 +0,0 @@
|
||||
//
|
||||
// TraceEventCache.cs
|
||||
//
|
||||
// Author:
|
||||
// Atsushi Enomoto <atsushi@ximian.com>
|
||||
//
|
||||
// Copyright (C) 2007 Novell, Inc.
|
||||
//
|
||||
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining
|
||||
// a copy of this software and associated documentation files (the
|
||||
// "Software"), to deal in the Software without restriction, including
|
||||
// without limitation the rights to use, copy, modify, merge, publish,
|
||||
// distribute, sublicense, and/or sell copies of the Software, and to
|
||||
// permit persons to whom the Software is furnished to do so, subject to
|
||||
// the following conditions:
|
||||
//
|
||||
// The above copyright notice and this permission notice shall be
|
||||
// included in all copies or substantial portions of the Software.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
||||
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
||||
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
||||
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
||||
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
//
|
||||
|
||||
using System;
|
||||
using System.Collections;
|
||||
using System.Text;
|
||||
using System.Threading;
|
||||
|
||||
namespace System.Diagnostics
|
||||
{
|
||||
public class TraceEventCache
|
||||
{
|
||||
DateTime started;
|
||||
CorrelationManager manager;
|
||||
string callstack, thread;
|
||||
int process;
|
||||
long timestamp;
|
||||
|
||||
public TraceEventCache ()
|
||||
{
|
||||
started = DateTime.Now;
|
||||
manager = Trace.CorrelationManager;
|
||||
callstack = Environment.StackTrace;
|
||||
timestamp = Stopwatch.GetTimestamp ();
|
||||
thread = Thread.CurrentThread.Name;
|
||||
process = Process.GetCurrentProcess ().Id;
|
||||
}
|
||||
|
||||
public string Callstack {
|
||||
get { return callstack; }
|
||||
}
|
||||
|
||||
public DateTime DateTime {
|
||||
get { return started; }
|
||||
}
|
||||
|
||||
public Stack LogicalOperationStack {
|
||||
get { return manager.LogicalOperationStack; }
|
||||
}
|
||||
|
||||
public int ProcessId {
|
||||
get { return process; }
|
||||
}
|
||||
|
||||
public string ThreadId {
|
||||
get { return thread; }
|
||||
}
|
||||
|
||||
public long Timestamp {
|
||||
get { return timestamp; }
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,54 +0,0 @@
|
||||
//
|
||||
// SourceLevels.cs
|
||||
//
|
||||
// Author:
|
||||
// Atsushi Enomoto <atsushi@ximian.com>
|
||||
//
|
||||
// Copyright (C) 2007 Novell, Inc.
|
||||
//
|
||||
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining
|
||||
// a copy of this software and associated documentation files (the
|
||||
// "Software"), to deal in the Software without restriction, including
|
||||
// without limitation the rights to use, copy, modify, merge, publish,
|
||||
// distribute, sublicense, and/or sell copies of the Software, and to
|
||||
// permit persons to whom the Software is furnished to do so, subject to
|
||||
// the following conditions:
|
||||
//
|
||||
// The above copyright notice and this permission notice shall be
|
||||
// included in all copies or substantial portions of the Software.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
||||
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
||||
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
||||
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
||||
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
//
|
||||
|
||||
using System.ComponentModel;
|
||||
|
||||
namespace System.Diagnostics
|
||||
{
|
||||
public enum TraceEventType
|
||||
{
|
||||
Critical = 1,
|
||||
Error = 2,
|
||||
Warning = 4,
|
||||
Information = 8,
|
||||
Verbose = 16,
|
||||
[EditorBrowsable (EditorBrowsableState.Advanced)]
|
||||
Start = 0x100,
|
||||
[EditorBrowsable (EditorBrowsableState.Advanced)]
|
||||
Stop = 0x200,
|
||||
[EditorBrowsable (EditorBrowsableState.Advanced)]
|
||||
Suspend = 0x400,
|
||||
[EditorBrowsable (EditorBrowsableState.Advanced)]
|
||||
Resume = 0x800,
|
||||
[EditorBrowsable (EditorBrowsableState.Advanced)]
|
||||
Transfer = 0x1000,
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,47 +0,0 @@
|
||||
//
|
||||
// TraceFilter.cs
|
||||
//
|
||||
// Author:
|
||||
// Atsushi Enomoto <atsushi@ximian.com>
|
||||
//
|
||||
// (C) 2007 Novell, Inc.
|
||||
//
|
||||
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining
|
||||
// a copy of this software and associated documentation files (the
|
||||
// "Software"), to deal in the Software without restriction, including
|
||||
// without limitation the rights to use, copy, modify, merge, publish,
|
||||
// distribute, sublicense, and/or sell copies of the Software, and to
|
||||
// permit persons to whom the Software is furnished to do so, subject to
|
||||
// the following conditions:
|
||||
//
|
||||
// The above copyright notice and this permission notice shall be
|
||||
// included in all copies or substantial portions of the Software.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
||||
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
||||
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
||||
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
||||
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
//
|
||||
using System;
|
||||
using System.IO;
|
||||
using System.Collections;
|
||||
using System.Diagnostics;
|
||||
using System.Runtime.CompilerServices;
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
namespace System.Diagnostics
|
||||
{
|
||||
public abstract class TraceFilter
|
||||
{
|
||||
public abstract bool ShouldTrace (TraceEventCache cache,
|
||||
string source, TraceEventType eventType,
|
||||
int id, string formatOrMessage,
|
||||
object [] args, object data1,
|
||||
object [] data);
|
||||
}
|
||||
}
|
||||
@@ -47,15 +47,16 @@ namespace System.Diagnostics {
|
||||
#pragma warning restore
|
||||
//public int IndentLevel;
|
||||
public int IndentSize = 4;
|
||||
public TraceListenerCollection Listeners = new TraceListenerCollection (false);
|
||||
public TraceListenerCollection Listeners = new TraceListenerCollection ();
|
||||
|
||||
public TraceImplSettings ()
|
||||
{
|
||||
Listeners.Add (new DefaultTraceListener (), this);
|
||||
Listeners.Add (new DefaultTraceListener () { IndentSize = this.IndentSize });
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
/*
|
||||
static class TraceImpl {
|
||||
|
||||
#if !MOBILE
|
||||
@@ -413,5 +414,6 @@ namespace System.Diagnostics {
|
||||
WriteLine (message, category);
|
||||
}
|
||||
}
|
||||
*/
|
||||
}
|
||||
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user