ActionFiltersAndOrdering.Filters.LoggerUtil.WriteLog C# (CSharp) Method

WriteLog() public static method

public static WriteLog ( string loggerName, string loggerMethodName, string controllerName, string actionName ) : void
loggerName string
loggerMethodName string
controllerName string
actionName string
return void
        public static void WriteLog(
            string loggerName, string loggerMethodName, 
            string controllerName, string actionName) {

            var logFormat = 
                "{0}, {1} method for Controller {2}, Action {3} is running...";

            Trace.TraceInformation(
                logFormat,
                loggerName, 
                loggerMethodName, 
                actionName, 
                controllerName);
        }
    }

Usage Example

Example #1
0
        public override void OnActionExecuting(
            HttpActionContext actionContext)
        {
            var controllerCtx = actionContext.ControllerContext;

            LoggerUtil.WriteLog(
                _loggerName,
                "OnActionExecuting",
                controllerCtx.ControllerDescriptor.ControllerName,
                actionContext.ActionDescriptor.ActionName
                );
        }
LoggerUtil