public InfoLogger(string categoryName, IMemoryCache cache, IHttpContextAccessor httpContextAccessor) { _categoryName = categoryName; _cache = cache; _httpContextAccessor = httpContextAccessor; CommonLogData commonData = _httpContextAccessor.GetCommonLogData(); _userTraceId = commonData.TraceId; _username = commonData.Username; _localIpAddress = commonData.LocalIP; _remoteIpAddress = commonData.RemoteIP; }
public TraceLogger(IMemoryCache cache, IHttpContextAccessor httpContextAccessor) { _cache = cache; _httpContextAccessor = httpContextAccessor; var request = _httpContextAccessor.HttpContext.Request; _source = $"{request.Method} {request.Scheme}://{request.Host}{request.Path}{request.QueryString}"; CommonLogData commonData = _httpContextAccessor.GetCommonLogData(); _userTraceId = commonData.TraceId; _username = commonData.Username; _localIpAddress = commonData.LocalIP; _remoteIpAddress = commonData.RemoteIP; }