-
Notifications
You must be signed in to change notification settings - Fork 14
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Replaced existing Trace Provider with a SharePoint 2010 diagnostics s…
…ervice.
- Loading branch information
Showing
9 changed files
with
208 additions
and
230 deletions.
There are no files selected for viewing
82 changes: 82 additions & 0 deletions
82
...edAuthentication/Visigo.Sharepoint.FormsBasedAuthentication/Code/FBADiagnosticsService.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,82 @@ | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Linq; | ||
using System.Text; | ||
using Microsoft.SharePoint; | ||
using Microsoft.SharePoint.Administration; | ||
using System.Runtime.InteropServices; | ||
|
||
namespace Visigo.Sharepoint.FormsBasedAuthentication | ||
{ | ||
class FBADiagnosticsService : SPDiagnosticsServiceBase | ||
{ | ||
|
||
public static string AreaName = "SharePoint 2010 FBA Pack"; | ||
|
||
public static string ServiceName = "SharePoint 2010 FBA Pack Diagnostics Service"; | ||
|
||
public enum FBADiagnosticsCategory | ||
{ | ||
General | ||
} // enum MyDiagnosticsCategory | ||
|
||
public FBADiagnosticsService() | ||
: base(ServiceName, SPFarm.Local) | ||
{ | ||
} // ctor() | ||
|
||
public FBADiagnosticsService(string name, SPFarm parent) | ||
: base(name, parent) | ||
{ | ||
// SPDiagnosticsServiceBase.GetLocal() wants the default ctor and this one | ||
} // ctor() | ||
|
||
protected override bool HasAdditionalUpdateAccess() | ||
{ | ||
// Without this SPDiagnosticsServiceBase.GetLocal<MyDiagnosticsService>() | ||
// throws a SecurityException, see | ||
// http://share2010.wordpress.com/tag/sppersistedobject/ | ||
return true; | ||
} // HasAdditionalUpdateAccess() | ||
|
||
public static FBADiagnosticsService Local | ||
{ | ||
get | ||
{ | ||
// SPUtility.ValidateFormDigest(); doesn't work here | ||
if (SPContext.Current != null) | ||
{ | ||
SPContext.Current.Web.AllowUnsafeUpdates = true; | ||
} | ||
// (Else assume this is called from a FeatureReceiver) | ||
return SPDiagnosticsServiceBase.GetLocal<FBADiagnosticsService>(); | ||
} | ||
} // Local | ||
|
||
public void WriteTrace(ushort id, FBADiagnosticsCategory fbaDiagnosticsCategory, TraceSeverity traceSeverity, string message, params object[] data) | ||
{ | ||
if (traceSeverity != TraceSeverity.None) | ||
{ | ||
// traceSeverity==TraceSeverity.None would cause an ArgumentException: | ||
// "Specified value is not supported for the severity parameter." | ||
SPDiagnosticsCategory category = Local.Areas[AreaName].Categories[fbaDiagnosticsCategory.ToString()]; | ||
Local.WriteTrace(id, category, traceSeverity, message, data); | ||
} | ||
} // LogMessage() | ||
|
||
protected override IEnumerable<SPDiagnosticsArea> ProvideAreas() | ||
{ | ||
List<SPDiagnosticsCategory> categories = new List<SPDiagnosticsCategory>(); | ||
categories.Add(new SPDiagnosticsCategory(FBADiagnosticsCategory.General.ToString(), TraceSeverity.Verbose, EventSeverity.Verbose)); | ||
|
||
SPDiagnosticsArea area = new SPDiagnosticsArea(AreaName, 0, 0, false, categories); | ||
|
||
List<SPDiagnosticsArea> areas = new List<SPDiagnosticsArea>(); | ||
|
||
areas.Add(area); | ||
|
||
return areas; | ||
} // ProvideAreas() | ||
|
||
} | ||
} |
213 changes: 0 additions & 213 deletions
213
...FormsBasedAuthentication/Visigo.Sharepoint.FormsBasedAuthentication/Code/TraceProvider.cs
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.