Messaging: Improve logging

This commit is contained in:
Jonathan Jenne 2022-11-02 13:36:00 +01:00
parent d18ebfe912
commit 6ebd3b82b6

View File

@ -113,17 +113,21 @@ Public Class Limilab
End Try End Try
End Function End Function
Public Function IMAPGetMessageIDs_AllMails() As List(Of Long) Public Function IMAPGetMessageIDs_AllMails() As List(Of Long)
Dim oListuids As New List(Of Long)
Logger.Debug("Starting IMAPGetMessageIDs ...") Logger.Debug("Starting IMAPGetMessageIDs ...")
If Initialized = False Then If Initialized = False Then
Return Nothing Return Nothing
End If End If
Try Try
Dim oConnect As Boolean = ImapConnect() Dim oConnectionSuccessful As Boolean = ImapConnect()
Dim oListuids As List(Of Long)
If oConnect = True Then If oConnectionSuccessful = True Then
Logger.Debug("Checking for new messages..")
oListuids = ImapGetMessageIDs_All() oListuids = ImapGetMessageIDs_All()
CURR_ListUIDs = oListuids CURR_ListUIDs = oListuids
Else
Logger.Warn("Connection was NOT successful. Returning Nothing.")
Return Nothing
End If End If
Return oListuids Return oListuids
Catch ex As Exception Catch ex As Exception
@ -223,10 +227,13 @@ Public Class Limilab
Private Function ImapGetMessageIDs_All() As List(Of Long) Private Function ImapGetMessageIDs_All() As List(Of Long)
Dim oListuids As New List(Of Long) Dim oListuids As New List(Of Long)
Try Try
Logger.Debug("Opening Inbox..")
CurrentImapObject.SelectInbox() CurrentImapObject.SelectInbox()
Logger.Debug("Searching messages..")
oListuids = CurrentImapObject.Search(Flag.All) oListuids = CurrentImapObject.Search(Flag.All)
Logger.Debug("[{0}] messages found.", oListuids.Count)
Return oListuids Return oListuids
Catch ex As Exception Catch ex As Exception
Logger.Error(ex) Logger.Error(ex)