2009-02-26 Marek Habersack <mhabersack@novell.com>
authorMarek Habersack <grendel@twistedcode.net>
Thu, 26 Feb 2009 02:32:53 +0000 (02:32 -0000)
committerMarek Habersack <grendel@twistedcode.net>
Thu, 26 Feb 2009 02:32:53 +0000 (02:32 -0000)
* System.Web.dll.sources: added System.Web/IisTraceListener.cs

2009-02-26  Marek Habersack  <mhabersack@novell.com>

* IisTraceListener.cs: added + implemented

svn path=/trunk/mcs/; revision=128046

mcs/class/System.Web/ChangeLog
mcs/class/System.Web/System.Web.dll.sources
mcs/class/System.Web/System.Web/ChangeLog
mcs/class/System.Web/System.Web/IisTraceListener.cs [new file with mode: 0644]

index 942d0aabfe1016501884973b3cac777ed1bf00e2..66ec11810fe4c179e57fa597c3ccf2317679da6b 100644 (file)
@@ -1,3 +1,7 @@
+2009-02-26  Marek Habersack  <mhabersack@novell.com>
+
+       * System.Web.dll.sources: added System.Web/IisTraceListener.cs
+
 2009-02-05  Marek Habersack  <mhabersack@novell.com>
 
        * Makefile (TEST_RESOURCE_FILES): added
index f4a80e2258409a27f9d2982892e1bffc039f91f6..a969e03119c49f4062669f50bee3358c1f827600 100644 (file)
@@ -338,6 +338,7 @@ System.Web/IHttpHandler.cs
 System.Web/IHttpHandlerFactory.cs
 System.Web/IHttpMapPath.cs
 System.Web/IHttpModule.cs
+System.Web/IisTraceListener.cs
 System.Web/IPartitionResolver.cs
 System.Web/InputFilterStream.cs
 System.Web/OutputFilterStream.cs
index ed81d24d9ad0770408076f781b0cedaf347e7e25..8c920d66d7f730b050dbf2a898c4413e9037eb26 100644 (file)
@@ -1,3 +1,7 @@
+2009-02-26  Marek Habersack  <mhabersack@novell.com>
+
+       * IisTraceListener.cs: added + implemented
+
 2009-02-25  Marek Habersack  <mhabersack@novell.com>
 
        * HttpApplication.cs: let the current context known that
diff --git a/mcs/class/System.Web/System.Web/IisTraceListener.cs b/mcs/class/System.Web/System.Web/IisTraceListener.cs
new file mode 100644 (file)
index 0000000..621d638
--- /dev/null
@@ -0,0 +1,90 @@
+//
+// System.Web.IisTraceListener.cs 
+//
+// Author:
+//     Marek Habersack (mhabersack@novell.com)
+//
+// Copyright (C) 2009 Novell, Inc (http://www.novell.com)
+//
+// 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.
+//
+#if NET_2_0
+using System;
+using System.Diagnostics;
+using System.Runtime.InteropServices;
+using System.Security.Permissions;
+
+namespace System.Web
+{
+       //
+       // Since we don't have a use for this class right now and we don't run it under IIS 7, we
+       // will just call the base class to do the work in some cases and for the remaining methods
+       // we will mimic the behavior of WebPageTraceListener.
+       //
+       [AspNetHostingPermissionAttribute(SecurityAction.LinkDemand, Level = AspNetHostingPermissionLevel.Minimal)]
+       [HostProtectionAttribute(SecurityAction.LinkDemand, Synchronization = true)]
+       public sealed class IisTraceListener : TraceListener
+       {
+               public IisTraceListener ()
+               {
+               }
+
+               public override void TraceData (TraceEventCache eventCache, string source, TraceEventType eventType, int id, object data)
+               {
+                       base.TraceData (eventCache, source, eventType, id, data);
+               }
+
+               public override void TraceData (TraceEventCache eventCache, string source, TraceEventType eventType, int id, params object[] data)
+               {
+                       base.TraceData (eventCache, source, eventType, id, data);
+               }
+
+               public override void TraceEvent (TraceEventCache eventCache, string source, TraceEventType severity, int id, string message)
+               {
+                       base.TraceEvent (eventCache, source, severity, id, message);
+               }
+
+               public override void TraceEvent (TraceEventCache eventCache, string source, TraceEventType severity, int id, string format, params object[] args)
+               {
+                       base.TraceEvent (eventCache, source, severity, id, format, args);
+               }
+               
+               public override void Write (string message)
+               {
+                       HttpContext.Current.Trace.Write (message);
+               }
+
+               public override void Write (string message, string category)
+               {
+                       Write (message);
+               }
+
+               public override void WriteLine (string message)
+               {
+                       HttpContext.Current.Trace.Write (message + Environment.NewLine);
+               }
+
+               public override void WriteLine (string message, string category)
+               {
+                       WriteLine (message);
+               }
+       }
+}
+#endif
\ No newline at end of file