update UI service client to allow for SetLogLevel

This commit is contained in:
dovholuknf
2020-10-07 19:20:53 -04:00
parent ff39c945d1
commit 3fbe2378e0
2 changed files with 45 additions and 0 deletions
+28
View File
@@ -24,8 +24,20 @@ using System.Windows.Documents;
/// </summary>
namespace ZitiDesktopEdge.ServiceClient
{
public enum LogLevelEnum
{
FATAL = 0,
ERROR = 1,
WARN = 2,
INFO = 3,
DEBUG = 4,
TRACE = 5,
VERBOSE = 6,
}
internal class Client
{
public const int EXPECTED_API_VERSION = 1;
public event EventHandler<TunnelStatusEvent> OnTunnelStatusEvent;
@@ -378,6 +390,22 @@ namespace ZitiDesktopEdge.ServiceClient
}
}
public void SetLogLevel(LogLevelEnum level)
{
try
{
send(new SetLogLevelFunction(Enum.GetName(level.GetType(), level)));
SvcResponse resp = read<SvcResponse>(ipcReader);
return;
}
catch (IOException ioe)
{
//almost certainly a problem with the pipe - recreate the pipe...
//setupPipe();
throw ioe;
}
}
public Identity IdentityOnOff(string fingerprint, bool onOff)
{
try
@@ -73,6 +73,10 @@ namespace ZitiDesktopEdge.ServiceClient
public bool OnOff { get; set; }
public string Fingerprint { get; set; }
}
public class SetLogLevelPayload
{
public string Level { get; set; }
}
public class IdentityToggleFunction : ServiceFunction
{
@@ -88,6 +92,19 @@ namespace ZitiDesktopEdge.ServiceClient
public IdentityTogglePayload Payload { get; set; }
}
public class SetLogLevelFunction : ServiceFunction
{
public SetLogLevelFunction(string level)
{
this.Function = "SetLogLevel";
this.Payload = new SetLogLevelPayload()
{
Level = level
};
}
public SetLogLevelPayload Payload { get; set; }
}
public class FingerprintPayload
{
public string Fingerprint { get; set; }