mirror of
				https://github.com/nsnail/Ocelot.git
				synced 2025-11-04 15:10:50 +08:00 
			
		
		
		
	Add LogTrace to IOcelotLogger
Previously only LogDebug and LogError were implemented, however this could/will lead to very noisy logging. Implementing trace should allow a better seperation when debugging.
This commit is contained in:
		@@ -29,6 +29,7 @@ namespace Ocelot.Logging
 | 
			
		||||
 | 
			
		||||
    public interface IOcelotLogger
 | 
			
		||||
    {
 | 
			
		||||
        void LogTrace(string message, params object[] args);
 | 
			
		||||
        void LogDebug(string message, params object[] args);
 | 
			
		||||
        void LogError(string message, Exception exception);
 | 
			
		||||
    }
 | 
			
		||||
@@ -44,6 +45,11 @@ namespace Ocelot.Logging
 | 
			
		||||
            _scopedDataRepository = scopedDataRepository;
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        public void LogTrace(string message, params object[] args)
 | 
			
		||||
        {
 | 
			
		||||
            _logger.LogTrace(GetMessageWithOcelotRequestId(message), args);
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        public void LogDebug(string message, params object[] args)
 | 
			
		||||
        {
 | 
			
		||||
            _logger.LogDebug(GetMessageWithOcelotRequestId(message), args);
 | 
			
		||||
 
 | 
			
		||||
@@ -34,7 +34,7 @@ namespace Ocelot.Responder.Middleware
 | 
			
		||||
 | 
			
		||||
        public async Task Invoke(HttpContext context)
 | 
			
		||||
        {
 | 
			
		||||
            _logger.LogDebug($"entered {MiddlwareName}");
 | 
			
		||||
            _logger.LogTrace($"entered {MiddlwareName}");
 | 
			
		||||
            _logger.LogDebug($"invoking next middleware from {MiddlwareName}");
 | 
			
		||||
 | 
			
		||||
            await _next.Invoke(context);
 | 
			
		||||
@@ -53,7 +53,7 @@ namespace Ocelot.Responder.Middleware
 | 
			
		||||
                _logger.LogDebug("no pipeline errors, setting and returning completed response");
 | 
			
		||||
                await _responder.SetResponseOnHttpContext(context, HttpResponseMessage);
 | 
			
		||||
            }
 | 
			
		||||
            _logger.LogDebug($"completed {MiddlwareName}");
 | 
			
		||||
            _logger.LogTrace($"completed {MiddlwareName}");
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        private void SetErrorResponse(HttpContext context, List<Error> errors)
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user