ApiController - rename applicationLogger -> appLogger

This commit is contained in:
DucDangAnh 2020-07-15 15:59:21 +07:00
parent e8fae43c1d
commit 646449b4ba

View File

@ -13,11 +13,11 @@ namespace AIParkingApplication
private HttpClient httpClient; private HttpClient httpClient;
private bool isHttpClientDisposabled; private bool isHttpClientDisposabled;
private int numberOfRetry; private int numberOfRetry;
private Logger applicationLogger; private Logger appLogger;
public ApiController(string serverIPAddress, Logger applicationLogger, int numberOfRetry = 3) public ApiController(string serverIPAddress, Logger appLogger, int numberOfRetry = 3)
{ {
this.applicationLogger = applicationLogger; this.appLogger = appLogger;
httpClient = new HttpClient httpClient = new HttpClient
{ {
BaseAddress = new Uri($"http://{serverIPAddress}"), BaseAddress = new Uri($"http://{serverIPAddress}"),
@ -74,7 +74,7 @@ namespace AIParkingApplication
catch (Exception ex) catch (Exception ex)
{ {
Console.WriteLine($"GetStatisticInfo Exception:\t{DateTime.Now.GetTimeFormatted()} \t {ex.Message}"); Console.WriteLine($"GetStatisticInfo Exception:\t{DateTime.Now.GetTimeFormatted()} \t {ex.Message}");
applicationLogger.Log(LogLevel.Info, $"Query dữ liệu thống kê bãi xe lỗi. exMessage: {ex.Message}"); appLogger.Log(LogLevel.Info, $"Query dữ liệu thống kê bãi xe lỗi. exMessage: {ex.Message}");
return null; return null;
} }
} }
@ -104,7 +104,7 @@ namespace AIParkingApplication
catch (Exception ex) catch (Exception ex)
{ {
Console.WriteLine($"CheckCard Exception:\t{DateTime.Now.GetTimeFormatted()} \t {ex.Message}"); Console.WriteLine($"CheckCard Exception:\t{DateTime.Now.GetTimeFormatted()} \t {ex.Message}");
applicationLogger.Log(LogLevel.Info, $"Query thông tin thẻ lỗi. Thẻ số: {cardNumber} | số lần thử lại: {requestCounter} | exMessage: {ex.Message}"); appLogger.Log(LogLevel.Info, $"Query thông tin thẻ lỗi. Thẻ số: {cardNumber} | số lần thử lại: {requestCounter} | exMessage: {ex.Message}");
return null; return null;
} }
} }
@ -149,7 +149,7 @@ namespace AIParkingApplication
catch (Exception ex) catch (Exception ex)
{ {
Console.WriteLine($"SaveLog Exception:\t{DateTime.Now.GetTimeFormatted()} \t {ex.Message}"); Console.WriteLine($"SaveLog Exception:\t{DateTime.Now.GetTimeFormatted()} \t {ex.Message}");
applicationLogger.Log(LogLevel.Info, string.Format("Không thể lưu log gửi xe. Làn: {0} | Mã thẻ: {1} | cameraID: {2} | Thời gian: {3} | Biển số: {4} | LogID: {5} | exMessage: ", direction == LaneDirection.In ? "IN" : "OUT", cardID, cameraID, timestamp, plateString, logID, ex.Message)); appLogger.Log(LogLevel.Info, string.Format("Không thể lưu log gửi xe. Làn: {0} | Mã thẻ: {1} | cameraID: {2} | Thời gian: {3} | Biển số: {4} | LogID: {5} | exMessage: ", direction == LaneDirection.In ? "IN" : "OUT", cardID, cameraID, timestamp, plateString, logID, ex.Message));
return null; return null;
} }
} }