Commits

Inside Zhou committed b66cbc9

将不该放到基础工具类库中的mvc相关代码移除。

Comments (0)

Files changed (1)

Web/MvcControllerBase.cs

 	public abstract class MvcControllerBase : Controller {
 		protected bool Debugging { get; private set; }
 
-		protected Stopwatch Stopwatch { get; private set; }
-
 		dynamic _useragent;
 		protected dynamic UserAgent {
 			get {
 		}
 
 		protected override void Initialize(System.Web.Routing.RequestContext requestContext) {
-			this.Stopwatch = Stopwatch.StartNew();
-
 			base.Initialize(requestContext);
 
 			this.Debugging = requestContext.HttpContext.IsDebuggingEnabled;
 		}
 
-		protected override void OnActionExecuting(ActionExecutingContext filterContext) {
-			base.OnActionExecuting(filterContext);
-
-			var evt = this.GetLogEvent("Operation.Hit", LogLevel.Info, null, null);
-			LogManager.GetLogger(evt.LoggerName).Log(evt);
-		}
-
 		protected override void OnActionExecuted(ActionExecutedContext filterContext) {
 			base.OnActionExecuted(filterContext);
 
 			}
 		}
 
-		protected override void OnResultExecuted(ResultExecutedContext filterContext) {
-			base.OnResultExecuted(filterContext);
-
-			var evt = this.GetLogEvent("Operation.Stopwatch", LogLevel.Info, null, null);
-			evt.Properties["Sort"] = this.Stopwatch.ElapsedMilliseconds;
-			LogManager.GetLogger(evt.LoggerName).Log(evt);
-		}
-
-		protected override void OnException(ExceptionContext filterContext) {
-			base.OnException(filterContext);
-
-			var evt = this.GetLogEvent("Exception.Controller", LogLevel.Error, filterContext.Exception, null, filterContext.Exception.StackTrace);
-			LogManager.GetLogger(evt.LoggerName).Log(evt);
-		}
-
-		protected virtual LogEventInfo GetLogEvent(string logger, LogLevel lvl, Exception e, string fmtTxt, params object[] parameters) {
-			var evt = new LogEventInfo(lvl, logger, null, string.IsNullOrEmpty(fmtTxt) ? (null == parameters || 0 == parameters.Length ? string.Empty : "{0}") : fmtTxt, parameters, e);
-			evt.Properties["YearAndMonth"] = DateTime.Now.ToString("yyyy-MM");
-			evt.Properties["HttpMethod"] = this.Request.RequestType;
-			evt.Properties["RawUrl"] = HttpUtility.UrlDecode(this.Request.RawUrl);
-			evt.Properties["Form"] = HttpUtility.UrlDecode(this.Request.Form.ToString());
-			return evt;
-		}
-
 		protected ActionResult ViewAsFile(string view_name, string content_type, object model, string file_download_name, string master_name = null) {
 			if(null != model) {
 				this.ViewData.Model = model;