Refactor some logging.

This commit is contained in:
2025-11-07 05:52:30 -05:00
parent 83fb28af9f
commit 46502f398d
2 changed files with 33 additions and 20 deletions

View File

@@ -159,7 +159,6 @@ namespace MarketData.Helper
return false;
}
MDTrace.WriteLine(LogLevel.DEBUG,String.Format("Got {0} dividend history records for {1}", dividendHistory.Count, symbol));
MDTrace.WriteLine(LogLevel.DEBUG,"Adding...");
if (DividendHistoryDA.InsertOrUpdate(dividendHistory)) MDTrace.WriteLine(LogLevel.DEBUG,String.Format("Added {0} dividend history records for {1}", dividendHistory.Count, symbol));
else MDTrace.WriteLine(LogLevel.DEBUG,String.Format("Failed to update dividend history for {0}", symbol));
return true;

View File

@@ -151,17 +151,24 @@ namespace MarketData.Helper
private static void LoadInsiderTransactionsSymbolEx(String symbol)
{
symbol = symbol.ToUpper();
MDTrace.WriteLine(LogLevel.DEBUG,String.Format("Load insider transactions for {0}", symbol));
InsiderTransactions insiderTransactions = MarketDataHelper.GetInsiderTransactions(symbol);
if (null == insiderTransactions || 0 == insiderTransactions.Count)
Profiler profiler = new Profiler();
try
{
MDTrace.WriteLine(LogLevel.DEBUG,String.Format("No insider transactions for {0}", symbol));
return;
symbol = symbol.ToUpper();
MDTrace.WriteLine(LogLevel.DEBUG,String.Format("Load insider transactions for {0}", symbol));
InsiderTransactions insiderTransactions = MarketDataHelper.GetInsiderTransactions(symbol);
if (null == insiderTransactions || 0 == insiderTransactions.Count)
{
MDTrace.WriteLine(LogLevel.DEBUG,String.Format("No insider transactions for {0}", symbol));
return;
}
MDTrace.WriteLine(LogLevel.DEBUG,String.Format("Insider Transactions, Saving {0} records for {1}", insiderTransactions.Count, symbol));
InsiderTransactionDA.InsertInsiderTransactions(insiderTransactions);
}
finally
{
MDTrace.WriteLine(LogLevel.DEBUG,$"{symbol} Done, took {profiler.End()}(ms)");
}
MDTrace.WriteLine(LogLevel.DEBUG,String.Format("Insider Transactions, Saving {0} records for {1}", insiderTransactions.Count, symbol));
InsiderTransactionDA.InsertInsiderTransactions(insiderTransactions);
MDTrace.WriteLine(LogLevel.DEBUG,"Insider Transactions - Done.");
}
private void ThreadPoolCallbackYearGreaterEqual(Object threadHelperContext)
@@ -176,18 +183,25 @@ namespace MarketData.Helper
private static void LoadInsiderTransactionsYearGreaterEqualEx(String symbol, int yearGreaterEqual)
{
symbol = symbol.ToUpper();
MDTrace.WriteLine(LogLevel.DEBUG,String.Format("Load insider transactions for {0} years>={1}", symbol,yearGreaterEqual));
InsiderTransactions insiderTransactions = MarketDataHelper.GetInsiderTransactionsYear(symbol, yearGreaterEqual);
if (null == insiderTransactions || 0 == insiderTransactions.Count)
Profiler profiler = new Profiler();
try
{
MDTrace.WriteLine(LogLevel.DEBUG,String.Format("No insider transactions for {0} years>={1}", symbol,yearGreaterEqual));
return;
symbol = symbol.ToUpper();
MDTrace.WriteLine(LogLevel.DEBUG,String.Format("Load insider transactions for {0} years>={1}", symbol,yearGreaterEqual));
InsiderTransactions insiderTransactions = MarketDataHelper.GetInsiderTransactionsYear(symbol, yearGreaterEqual);
if (null == insiderTransactions || 0 == insiderTransactions.Count)
{
MDTrace.WriteLine(LogLevel.DEBUG,String.Format("No insider transactions for {0} years>={1}", symbol,yearGreaterEqual));
return;
}
MDTrace.WriteLine(LogLevel.DEBUG,String.Format("Insider Transactions, Saving {0} records for {1} years>={2}", insiderTransactions.Count, symbol, yearGreaterEqual));
InsiderTransactionDA.DeleteInsiderTransactionsYearsGreaterEqual(symbol, yearGreaterEqual);
InsiderTransactionDA.InsertInsiderTransactions(insiderTransactions);
}
finally
{
MDTrace.WriteLine(LogLevel.DEBUG,$"{symbol} Done, took {profiler.End()}(ms)");
}
MDTrace.WriteLine(LogLevel.DEBUG,String.Format("Insider Transactions, Saving {0} records for {1} years>={2}", insiderTransactions.Count, symbol, yearGreaterEqual));
InsiderTransactionDA.DeleteInsiderTransactionsYearsGreaterEqual(symbol, yearGreaterEqual);
InsiderTransactionDA.InsertInsiderTransactions(insiderTransactions);
MDTrace.WriteLine(LogLevel.DEBUG,"Insider Transactions - Done.");
}
}
}