Code:
/ DotNET / DotNET / 8.0 / untmp / whidbey / REDBITS / ndp / fx / src / xsp / System / Web / WebPageTraceListener.cs / 1 / WebPageTraceListener.cs
//------------------------------------------------------------------------------ //// Copyright (c) Microsoft Corporation. All rights reserved. // //----------------------------------------------------------------------------- using System; using System.Web; using System.Web.UI; using System.Diagnostics; using System.Globalization; using System.Security.Permissions; namespace System.Web { [HostProtection(Synchronization=true)] [AspNetHostingPermission(SecurityAction.LinkDemand, Level=AspNetHostingPermissionLevel.Minimal)] [AspNetHostingPermission(SecurityAction.InheritanceDemand, Level=AspNetHostingPermissionLevel.Minimal)] public class WebPageTraceListener : TraceListener { public WebPageTraceListener() { } // the listener apis public override void Write(string message) { if (Filter != null && !Filter.ShouldTrace(null, String.Empty, TraceEventType.Verbose, 0, message, null, null, null)) return; HttpContext context = HttpContext.Current; if (context != null) context.Trace.WriteInternal(message, false); } public override void Write(string message, string category) { if (Filter != null && !Filter.ShouldTrace(null, String.Empty, TraceEventType.Verbose, 0, message, null, null, null)) return; HttpContext context = HttpContext.Current; if (context != null) context.Trace.WriteInternal(category, message, false); } public override void WriteLine(string message) { if (Filter != null && !Filter.ShouldTrace(null, String.Empty, TraceEventType.Verbose, 0, message, null, null, null)) return; HttpContext context = HttpContext.Current; if (context != null) context.Trace.WriteInternal(message, false); } public override void WriteLine(string message, string category) { if (Filter != null && !Filter.ShouldTrace(null, String.Empty, TraceEventType.Verbose, 0, message, null, null, null)) return; HttpContext context = HttpContext.Current; if (context != null) context.Trace.WriteInternal(category, message, false); } public override void TraceEvent(TraceEventCache eventCache, String source, TraceEventType severity, int id, string message) { if (Filter != null && !Filter.ShouldTrace(eventCache, source, severity, id, message, null, null, null)) return; HttpContext context = HttpContext.Current; if (context == null) return; string messagestring = SR.GetString(SR.WebPageTraceListener_Event) + " " + id + ": " + message; if (severity <= TraceEventType.Warning) context.Trace.WarnInternal(source, messagestring, false); else context.Trace.WriteInternal(source, messagestring, false); } public override void TraceEvent(TraceEventCache eventCache, String source, TraceEventType severity, int id, string format, params object[] args) { TraceEvent(eventCache, source, severity, id, String.Format(CultureInfo.InvariantCulture, format, args)); } } }
Link Menu

This book is available now!
Buy at Amazon US or
Buy at Amazon UK
- OutputCacheProviderCollection.cs
- PackagePart.cs
- SqlUtils.cs
- BatchStream.cs
- Int16AnimationBase.cs
- RootBrowserWindowAutomationPeer.cs
- TextPointerBase.cs
- Span.cs
- Point3D.cs
- MobileControlsSection.cs
- FilterEventArgs.cs
- XmlSchemaGroup.cs
- ISAPIRuntime.cs
- UiaCoreTypesApi.cs
- OdbcConnectionHandle.cs
- CannotUnloadAppDomainException.cs
- Domain.cs
- ResumeStoryboard.cs
- StyleCollection.cs
- AspProxy.cs
- SqlExpander.cs
- BitFlagsGenerator.cs
- Imaging.cs
- PeerService.cs
- StyleXamlTreeBuilder.cs
- CounterSet.cs
- SelectionBorderGlyph.cs
- TreeIterator.cs
- BindingCompleteEventArgs.cs
- DataGridViewRowHeaderCell.cs
- DataTemplateSelector.cs
- EntityDataSourceDataSelectionPanel.designer.cs
- StringValidatorAttribute.cs
- SqlTypeConverter.cs
- VideoDrawing.cs
- Common.cs
- NumberAction.cs
- OletxTransactionManager.cs
- CheckableControlBaseAdapter.cs
- RemoveFromCollection.cs
- EpmSourcePathSegment.cs
- HttpProfileBase.cs
- PresentationTraceSources.cs
- PageAsyncTaskManager.cs
- DocumentPageHost.cs
- SecurityIdentifierElementCollection.cs
- TryCatch.cs
- UndoUnit.cs
- CapiNative.cs
- ServicePoint.cs
- GridProviderWrapper.cs
- SectionUpdates.cs
- Storyboard.cs
- AppSettingsReader.cs
- ScriptingJsonSerializationSection.cs
- ToolBarPanel.cs
- CellRelation.cs
- EventLog.cs
- MsmqElementBase.cs
- AppearanceEditorPart.cs
- CodeAttributeDeclaration.cs
- _Connection.cs
- AutomationElement.cs
- BufferedStream.cs
- ProgressBar.cs
- CryptographicAttribute.cs
- CuspData.cs
- ProcessHostConfigUtils.cs
- PolicyStatement.cs
- ToolStripLocationCancelEventArgs.cs
- Compiler.cs
- cookiecontainer.cs
- PrintController.cs
- DecoderFallback.cs
- PageCodeDomTreeGenerator.cs
- GatewayDefinition.cs
- ISAPIWorkerRequest.cs
- WindowsFormsEditorServiceHelper.cs
- CompositeFontParser.cs
- LassoHelper.cs
- SiteMapDataSourceView.cs
- WebPartAuthorizationEventArgs.cs
- EntitySetRetriever.cs
- XmlUtil.cs
- SqlCharStream.cs
- X509Extension.cs
- PrintControllerWithStatusDialog.cs
- StylusCaptureWithinProperty.cs
- Tablet.cs
- HttpCacheVaryByContentEncodings.cs
- TypeTypeConverter.cs
- XsdCachingReader.cs
- ExpandedProjectionNode.cs
- Size3DConverter.cs
- XmlReflectionMember.cs
- QilGeneratorEnv.cs
- NativeCppClassAttribute.cs
- Int32Animation.cs
- documentsequencetextpointer.cs
- ObjectFullSpanRewriter.cs