1
0
mirror of https://github.com/Kopano-dev/kopano-ol-extension.git synced 2023-10-10 13:37:40 +02:00

[KOE-176] More logging

This commit is contained in:
Patrick Simpson 2018-09-25 13:11:52 +03:00
parent 41c547bf16
commit 46d02718a6
3 changed files with 19 additions and 9 deletions

View File

@ -192,15 +192,20 @@ namespace Acacia.Features.Signatures
using (ZPushConnection connection = account.Connect())
using (ZPushWebServiceInfo infoService = connection.InfoService)
{
Logger.Instance.Trace(this, "Executing request: {0}", account);
GetSignatures result = infoService.Execute(new GetSignaturesRequest());
Logger.Instance.Trace(this, "Executed request: {0} -> {1}", account, result);
// Store the signatures
Dictionary<object, string> fullNames = new Dictionary<object, string>();
using (ISignatures signatures = ThisAddIn.Instance.GetSignatures())
{
Logger.Instance.Trace(this, "Storing signatures: {0}", account);
foreach (Signature signature in result.all.Values)
{
Logger.Instance.Trace(this, "Storing signature: {0}: {1}", account, signature);
string name = StoreSignature(signatures, account, signature);
Logger.Instance.Trace(this, "Stored signature: {0}: {1}: {2}", account, name, signature);
fullNames.Add(signature.id, name);
}
}
@ -208,13 +213,16 @@ namespace Acacia.Features.Signatures
// Set default signatures if available and none are set
if (!string.IsNullOrEmpty(result.new_message) && ShouldSetSignature(account.SignatureNewMessage))
{
Logger.Instance.Trace(this, "Setting signature new message: {0}: {1}", account, result.new_message);
account.SignatureNewMessage = fullNames[result.new_message];
}
if (!string.IsNullOrEmpty(result.replyforward_message) && ShouldSetSignature(account.SignatureReplyForwardMessage))
{
Logger.Instance.Trace(this, "Setting signature reply message: {0}: {1}", account, result.replyforward_message);
account.SignatureReplyForwardMessage = fullNames[result.replyforward_message];
}
Logger.Instance.Trace(this, "Signature synced: {0}: {1}", account, result.hash);
return result.hash;
}
}

View File

@ -141,15 +141,17 @@ namespace Acacia.Utils
public static void Task(AcaciaTask task, bool synchronous = false)
{
Logger.Instance.Debug(typeof(Tasks), "TASK added: {0}", task);
Logger.Instance.Trace(typeof(Tasks), "TASK added: {0}", task);
if (synchronous)
{
Logger.Instance.Debug(typeof(Tasks), "TASK exec synchronous 1: {0}", task);
Logger.Instance.Trace(typeof(Tasks), "TASK exec synchronous 1: {0}", task);
task.Execute();
Logger.Instance.Debug(typeof(Tasks), "TASK exec synchronous 2: {0}", task);
Logger.Instance.Trace(typeof(Tasks), "TASK exec synchronous 2: {0}", task);
}
else
{
Executor.AddTask(task);
}
}
}
}

View File

@ -42,25 +42,25 @@ namespace Acacia.Utils
{
while (!_tasks.IsCompleted)
{
Logger.Instance.Debug(this, "Take task 1");
Logger.Instance.Trace(this, "Take task 1");
AcaciaTask task = _tasks.Take();
Logger.Instance.Debug(this, "Take task 2: {0}", task);
Logger.Instance.Trace(this, "Take task 2: {0}", task);
PerformTask(task);
Logger.Instance.Debug(this, "Take task 3: {0}", task);
Logger.Instance.Trace(this, "Take task 3: {0}", task);
}
Logger.Instance.Debug(this, "Worker completed");
}
catch(Exception e)
{
Logger.Instance.Debug(this, "Worker failure: {0}", e);
Logger.Instance.Warning(this, "Worker failure: {0}", e);
}
}
protected override void EnqueueTask(AcaciaTask task)
{
Logger.Instance.Debug(this, "EnqueueTask 1: {0}", task);
Logger.Instance.Trace(this, "EnqueueTask 1: {0}", task);
_tasks.Add(task);
Logger.Instance.Debug(this, "EnqueueTask 2: {0}", task);
Logger.Instance.Trace(this, "EnqueueTask 2: {0}", task);
}
override public string Name { get { return "Background"; } }