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");
}
}
}
Showing posts with label sharepoint 2007. Show all posts
Showing posts with label sharepoint 2007. Show all posts
Monday, September 10, 2012
SPMonitoredScope for Sharepoint 2007
If you want to use "standart" SPContext in console
If you want to use "standart" SPContext in console:
www.superedge.net: How to create your own SharePoint HttpContext
Subscribe to:
Posts (Atom)