Ancora riorganizzaizone messaggi ed eventi su vari livelli log

This commit is contained in:
Samuele Locatelli
2021-12-17 09:30:21 +01:00
parent 13b5aa4886
commit ecbb2d0ea8
4 changed files with 29 additions and 23 deletions
+1 -1
View File
@@ -3634,7 +3634,7 @@ namespace IOB_WIN_NEXT
if (utils.CRB("enableContapezzi"))
{
// rilettura contapezzi da server...
lgInfo("Ciclo VLF: pzCntReload(true)");
lgTrace("Ciclo VLF: pzCntReload(true)");
if (!isMulti)
{
pzCntReload(true);
+1 -1
View File
@@ -734,7 +734,7 @@ namespace IOB_WIN_NEXT
int vFactor = 2;
if (vetoCheckStatus < adesso)
{
lgDebug($"Stato variabili checkPing: {testPingMachine}");
lgTrace($"Stato variabili checkPing: {testPingMachine}");
// imposto veto per vetoSeconds...
vetoCheckStatus = adesso.AddSeconds(vetoSeconds * vFactor);
}
+5 -5
View File
@@ -194,10 +194,10 @@ namespace IOB_WIN_NEXT
// faccio preliminarmente upsertKey...
upsertKey(currMem.name, currMem.value);
serObj = JsonConvert.SerializeObject(item);
lgInfo($"Inizio processing plcWriteParams per {currMem.name} | valore richiesto {currMem.value}");
lgInfo($"---------------{Environment.NewLine}UPDATED PARAM:{Environment.NewLine}{serObj}{Environment.NewLine}---------------");
lgDebug($"Inizio processing plcWriteParams per {currMem.name} | valore richiesto {currMem.value}");
lgDebug($"---------------{Environment.NewLine}UPDATED PARAM:{Environment.NewLine}{serObj}{Environment.NewLine}---------------");
serObj = JsonConvert.SerializeObject(currMem);
lgInfo($"---------------{Environment.NewLine}MEMORY CONTENT:{Environment.NewLine}{serObj}{Environment.NewLine}---------------");
lgDebug($"---------------{Environment.NewLine}MEMORY CONTENT:{Environment.NewLine}{serObj}{Environment.NewLine}---------------");
switch (currMem.tipoMem)
{
@@ -252,12 +252,12 @@ namespace IOB_WIN_NEXT
}
else
{
lgInfo($"Errore: memAddrWrite vuoto!");
lgError($"Errore: memAddrWrite vuoto!");
}
}
else
{
lgInfo($"Errore uid non trovato in area write memory: {item.uid}, ci sono {memMap.mMapWrite.Count} in area write");
lgError($"Errore uid non trovato in area write memory: {item.uid}, ci sono {memMap.mMapWrite.Count} in area write");
}
}
catch (Exception exc)
+22 -16
View File
@@ -185,7 +185,7 @@ namespace IOB_WIN_NEXT
{
eh_MonItChange(this, new opcUaMonitItemChange(monitoredItem, notification));
}
lgDebug($"Notification Received | Variable: {monitoredItem.DisplayName} | Value: {notification.Value}");
lgTrace($"Notification Received | Variable: {monitoredItem.DisplayName} | Value: {notification.Value}");
}
catch (Exception ex)
{
@@ -224,10 +224,16 @@ namespace IOB_WIN_NEXT
protected void lgDebug(string message)
{
lg.Factory.Configuration.Variables["codIOB"] = currIob;
//if (isLogVerbose)
//{
lg.Info(message);
//}
}
/// <summary>
/// Effettua logging TRACE corretto impostanto anche la variabile IOB prima di scrivere...
/// </summary>
/// <param name="message"></param>
protected void lgTrace(string message)
{
lg.Factory.Configuration.Variables["codIOB"] = currIob;
lg.Trace(message);
}
#endregion Protected Methods
@@ -261,15 +267,15 @@ namespace IOB_WIN_NEXT
NodeId nodeToBrowse = new NodeId(startNodeVal, startNodeNS);
// Call Browse service
lgInfo($"Browsing {nodeToBrowse} node...");
lgTrace($"Browsing {nodeToBrowse} node...");
ReferenceDescriptionCollection browseResults = browser.Browse(nodeToBrowse);
// Display the results
lgInfo($"Browse returned {browseResults.Count} results:");
lgTrace($"Browse returned {browseResults.Count} results:");
foreach (ReferenceDescription result in browseResults)
{
lgDebug($" NodeId = {result.NodeId}, DisplayName = {result.DisplayName.Text}, NodeClass = {result.NodeClass}, Others: {result.BinaryEncodingId} | {result.BrowseName}");
lgTrace($" NodeId = {result.NodeId}, DisplayName = {result.DisplayName.Text}, NodeClass = {result.NodeClass}, Others: {result.BinaryEncodingId} | {result.BrowseName}");
// se NON fa parte dell'elenco dei VETO di filterItems...
if (!vetoBrowse.Contains($"{result.NodeId}"))
{
@@ -318,23 +324,23 @@ namespace IOB_WIN_NEXT
NodeId nodeToBrowse = new NodeId(browsePath);
// Call Browse service
lgInfo($"Browsing {nodeToBrowse} node...");
lgTrace($"Browsing {nodeToBrowse} node...");
ReferenceDescriptionCollection browseResults = browser.Browse(nodeToBrowse);
// Display the results
lgInfo($"Browse returned {browseResults.Count} results:");
lgTrace($"Browse returned {browseResults.Count} results:");
foreach (ReferenceDescription result in browseResults)
{
// se veto --> loggo veto
if (vetoBrowse.Contains($"{result.NodeId}"))
{
lgDebug($"| FILTERED --> NodeId = {result.NodeId}, DisplayName = {result.DisplayName.Text}, NodeClass = {result.NodeClass}, Others: {result.BinaryEncodingId} | {result.BrowseName}");
lgTrace($"| FILTERED --> NodeId = {result.NodeId}, DisplayName = {result.DisplayName.Text}, NodeClass = {result.NodeClass}, Others: {result.BinaryEncodingId} | {result.BrowseName}");
}
// se NON fa parte dell'elenco dei VETO di filterItems...
else
{
lgDebug($" NodeId = {result.NodeId}, DisplayName = {result.DisplayName.Text}, NodeClass = {result.NodeClass}, Others: {result.BinaryEncodingId} | {result.BrowseName}");
lgTrace($" NodeId = {result.NodeId}, DisplayName = {result.DisplayName.Text}, NodeClass = {result.NodeClass}, Others: {result.BinaryEncodingId} | {result.BrowseName}");
// se mancasse aggiungo...
if (!nodeIdNameList.ContainsKey($"{result.NodeId}"))
{
@@ -449,7 +455,7 @@ namespace IOB_WIN_NEXT
catch (Exception ex)
{
// Log Error
lgInfo($"Create Session Error : {ex.Message}");
lgError($"Create Session Error : {ex.Message}");
return false;
}
}
@@ -474,7 +480,7 @@ namespace IOB_WIN_NEXT
}
else
{
lgInfo("Session not created!");
lgError("Session not created!");
}
}
catch (Exception ex)
@@ -603,7 +609,7 @@ namespace IOB_WIN_NEXT
// Display the results.
foreach (DataValue result in resultsValues)
{
lgDebug($"Read Value = {result.Value} , StatusCode = {result.StatusCode}");
lgTrace($"Read Value = {result.Value} , StatusCode = {result.StatusCode}");
}
#endregion Read a node by calling the Read Service
@@ -611,10 +617,10 @@ namespace IOB_WIN_NEXT
#region Read the Value attribute of a node by calling the Session.ReadValue method
// Read Server NamespaceArray
lgInfo("Reading Value of NamespaceArray node...");
lgTrace("Reading Value of NamespaceArray node...");
DataValue namespaceArray = m_session.ReadValue(Variables.Server_NamespaceArray);
// Display the result
lgInfo($"NamespaceArray Value = {namespaceArray}");
lgTrace($"NamespaceArray Value = {namespaceArray}");
#endregion Read the Value attribute of a node by calling the Session.ReadValue method
}