Skip to content

Commit

Permalink
adding logging in element class
Browse files Browse the repository at this point in the history
  • Loading branch information
RijadComor committed Jul 15, 2024
1 parent 8f8d454 commit f0027ce
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 1 deletion.
1 change: 1 addition & 0 deletions ConnectorAPI.EVS.IPD-VIA/ConnectorAPI.EVS.IPD-VIA.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -28,5 +28,6 @@

<ItemGroup>
<PackageReference Include="Skyline.DataMiner.Core.InterAppCalls.Common" Version="1.0.1.1" />
<PackageReference Include="Skyline.DataMiner.Utils.YLE.Logging" Version="1.0.2" />
</ItemGroup>
</Project>
10 changes: 9 additions & 1 deletion ConnectorAPI.EVS.IPD-VIA/EvsIpdViaElement.cs
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ public class EvsIpdViaElement
private IDictionary<string, object[]> targetsTable;
private IDictionary<string, object[]> recodersTable;
private TimeSpan? timeout;
private ILogger logObject;

private static readonly List<Type> knownTypes = new List<Type>
{
Expand Down Expand Up @@ -54,7 +55,7 @@ public class EvsIpdViaElement
/// <param name="elementId">ID of the EVS element.</param>
/// <exception cref="ArgumentNullException">Thrown when the provided connection or the element is null.</exception>
/// <exception cref="InvalidOperationException">Thrown when described element is inactive.</exception>
public EvsIpdViaElement(IConnection connection, int agentId, int elementId)
public EvsIpdViaElement(IConnection connection, int agentId, int elementId, ILogger logObject)
{
this.connection = connection ?? throw new ArgumentNullException(nameof(connection));
element = connection.GetDms().GetElement(new DmsElementId(agentId, elementId));
Expand All @@ -76,7 +77,9 @@ public TimeSpan Timeout
{
if (timeout != null) return (TimeSpan)timeout;
double timeoutInSeconds = element.GetStandaloneParameter<double>(EvsIpdViaProtocol.InterAppTimeout).GetValue();
logObject.Log(nameof(EvsIpdViaElement), nameof(Timeout), $"Timeout in seconds: {timeoutInSeconds}");
timeout = TimeSpan.FromSeconds(timeoutInSeconds);
logObject.Log(nameof(EvsIpdViaElement), nameof(Timeout), $"Timeout in timespan: {timeout}");
return (TimeSpan)timeout;
}
}
Expand Down Expand Up @@ -310,5 +313,10 @@ private bool TrySendMessage<T>(Message message, bool requiresResponse, out strin

return true;
}

public void Log(string nameOfClass, string nameOfMethod, string message)
{

}
}
}
7 changes: 7 additions & 0 deletions ConnectorAPI.EVS.IPD-VIA/ILogger.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
namespace Skyline.DataMiner.ConnectorAPI.EVS.IPD_VIA
{
public interface ILogger
{
void Log(string nameOfClass, string nameOfMethod, string message);
}
}

0 comments on commit f0027ce

Please sign in to comment.