remove console.writelines from code.
Add trace log output to DataCenterHelper. #90
This commit is contained in:
parent
9ba44d273e
commit
28d9b14983
@ -106,7 +106,7 @@ namespace CardReaderService
|
|||||||
_logger.Trace("Card Inserted, ATR: " + atrString + ", and UID is: " + uid);
|
_logger.Trace("Card Inserted, ATR: " + atrString + ", and UID is: " + uid);
|
||||||
|
|
||||||
var postObj = new CardDataPost {CardUId = uid};
|
var postObj = new CardDataPost {CardUId = uid};
|
||||||
DataCenterHelper.PostAsync(postObj, "/api/swipedata");
|
DataCenterHelper.PostAsync(_logger, postObj, "/api/swipedata");
|
||||||
_logger.Trace("Posted to Server");
|
_logger.Trace("Posted to Server");
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@ -191,7 +191,7 @@ namespace CardReaderService
|
|||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
Console.WriteLine(_cardMonitor.GetCurrentState(0));
|
_logger.Trace(_cardMonitor.GetCurrentState(0).ToString());
|
||||||
if (_cardMonitor.GetCurrentState(0) == SCRState.Unknown
|
if (_cardMonitor.GetCurrentState(0) == SCRState.Unknown
|
||||||
|| _cardMonitor.GetCurrentState(0) == SCRState.Unavailable
|
|| _cardMonitor.GetCurrentState(0) == SCRState.Unavailable
|
||||||
|| _cardMonitor.GetCurrentState(0) == (SCRState.Ignore | SCRState.Unavailable)
|
|| _cardMonitor.GetCurrentState(0) == (SCRState.Ignore | SCRState.Unavailable)
|
||||||
|
|||||||
@ -5,13 +5,14 @@ using System.Linq;
|
|||||||
using System.Net.Http;
|
using System.Net.Http;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
|
using Interfaces;
|
||||||
using Newtonsoft.Json;
|
using Newtonsoft.Json;
|
||||||
|
|
||||||
namespace CardReaderService
|
namespace CardReaderService
|
||||||
{
|
{
|
||||||
static class DataCenterHelper
|
static class DataCenterHelper
|
||||||
{
|
{
|
||||||
public static void Post(CardDataPost postObject, string url)
|
public static void Post(ILogger logger, CardDataPost postObject, string url)
|
||||||
{
|
{
|
||||||
var endpointConfig = ConfigurationHandler.ConfigurationHandler.GetConfiguration("DataCenterServiceEndpoint") ??
|
var endpointConfig = ConfigurationHandler.ConfigurationHandler.GetConfiguration("DataCenterServiceEndpoint") ??
|
||||||
"http://localhost:8800";
|
"http://localhost:8800";
|
||||||
@ -22,10 +23,10 @@ namespace CardReaderService
|
|||||||
var content = new StringContent(jsonObject, Encoding.UTF8, "application/json");
|
var content = new StringContent(jsonObject, Encoding.UTF8, "application/json");
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
Console.WriteLine("Writing");
|
logger.Trace("Writing");
|
||||||
var fullUrl = endpointConfig + url;
|
var fullUrl = endpointConfig + url;
|
||||||
var response = client.PostAsync(fullUrl, content).Result;
|
var response = client.PostAsync(fullUrl, content).Result;
|
||||||
Console.WriteLine("Written");
|
logger.Trace("Written");
|
||||||
}
|
}
|
||||||
catch (Exception)
|
catch (Exception)
|
||||||
{
|
{
|
||||||
@ -35,9 +36,9 @@ namespace CardReaderService
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static Task PostAsync(CardDataPost postObject, string url)
|
public static Task PostAsync(ILogger logger, CardDataPost postObject, string url)
|
||||||
{
|
{
|
||||||
return Task.Run(() => Post(postObject, url));
|
return Task.Run(() => Post(logger, postObject, url));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user