- ago
As my custom Optimizer is running, I would like to display progress text messages. This can let the user know when further improvement is unlikely and the optimization can be cancelled. Writing to the Connection and Exception log seems like a possibility. How would I do that? Or is there a better way?
3
1,140
Solved
6 Replies

Reply

Bookmark

Sort
Glitch8
 ( 9.89% )
- ago
#1
I would not clog up the Exception log with those messages, because it's unlikely that users would catch them there. I'll add an item in our requested features list for this capability.
0
- ago
#2
I'm the only user. Is there a way to write to the log from the custom Optimizer? I'm guessing not. My (ugly?) workaround is to use a StreamWriter text file that I Flush from time to time. I open the file from NotePad to watch the progress.
0
Glitch8
 ( 9.89% )
- ago
#3
WLHost.Instance.AddLogItem
2
- ago
#4
Initially, I was confused until I looked at the documentation, which is listed under IHost (the C# interface to WLHost) as it should be. But since WL automatically creates an instance of IHost, WLHost.Instance, that's what we want to reference in our methods.

Initially, I was searching for WLHost.Instance when I should have been searching for IHost instead. Now I understand.

The AddLogItem() call looks like a useful method. Interesting.
1
Glitch8
 ( 9.89% )
- ago
#5
Yes, we adopted a Singleton pattern here because previously we'd just be passing an instance of this interface all over the place. This cleans up many of the calls. And it allows the "IHost" interface to be accessed from anywhere :)
2
- ago
#6
Perfect for my purpose!
2
Best Answer

Reply

Bookmark

Sort