LoggerWriteLine Method |
Namespace: MailBee
The developer can use this method to add custom messages in the log. These messages will be formatted to the same rules as any other messages placed into the log. However, MailBee components (such as Smtp, Pop3, and Imap) do not raise LogNewEntry event when the log entry is added using this method. This allows the developer to call this method even inside LogNewEntry event handlers without getting endless recursion in the code.
Entries added with WriteLine(String) method are marked as [USER] in the log (as compared to [INFO], [SEND], or [RECV] entries produced by MailBee itself).
Note |
---|
In UWP apps, use async version of this method. |
// To use the code below, import MailBee namespaces at the top of your code. using MailBee; using MailBee.Pop3Mail; using MailBee.Mime; // The actual code (put it into a method of your class). Pop3 pop = new Pop3(); // Set logging parameters. pop.Log.Enabled = true; pop.Log.Filename = @"C:\Temp\pop3_log.txt"; pop.Log.Clear(); // Print Hello. pop.Log.WriteLine("Hello"); // After running this code, C:\Temp\pop3_log.txt file should look like below. [00:05:34.79] [USER] Hello