using System; using Microsoft.Practices.SPG.Common.Logging; using Microsoft.Practices.SPG.Common.ServiceLocation; namespace MyApp.Utils { public class MonitoredScope : IDisposable { DateTime time; string _scopeName; private ILogger Logger { get { return SharePointServiceLocator.Current.GetInstance(); } } public MonitoredScope(string scopeName) { time = DateTime.Now; _scopeName = scopeName; Logger.TraceToDeveloper(string.Concat("Enter scope: " + scopeName), 1313, Microsoft.SharePoint.Administration.TraceSeverity.Monitorable, "TWP"); } public void Dispose() { DateTime time2 = DateTime.Now; Logger.TraceToDeveloper(string.Concat("Leave scope: " + _scopeName, "; Duration: " + (time2 - time).ToString()), 1313, Microsoft.SharePoint.Administration.TraceSeverity.Monitorable, "TWP"); } } }
Monday, September 10, 2012
SPMonitoredScope for Sharepoint 2007
Labels:
sharepoint 2007
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment