Ejemplo n.º 1
0
        /// <inheritdoc />
        public void BeforeInvoke(InvocationContext invocationContext)
        {
            // Create a logger based on the class type that owns the executing method
            this.logger = this.loggerFactory.CreateLogger(invocationContext.GetOwningType());

            // Get the Logging Attribute
            this.loggingAttribute = invocationContext.GetAttributeFromMethod <LogAttribute>();

            // Get the Logging Level
            var loggingLevel = this.loggingAttribute.LoggingLevel;

            // Log the method being executed
            this.logger.Log(loggingLevel, $"{invocationContext.GetOwningType()}: Method executing: {invocationContext.GetExecutingMethodName()}");
        }
Ejemplo n.º 2
0
 /// <inheritdoc />
 public void AfterInvoke(InvocationContext invocationContext, object methodResult)
 {
     this.logger.Log(this.loggingAttribute.LoggingLevel, $"{invocationContext.GetOwningType()}: Method executed: {invocationContext.GetExecutingMethodName()}");
 }
Ejemplo n.º 3
0
 /// <inheritdoc />
 public void AfterInvoke(InvocationContext invocationContext, object methodResult)
 {
     // Save the result to the MemoryCache
     this.memoryCache.Set(invocationContext.GetExecutingMethodName(), methodResult);
 }