How to retrieve WB extensions Log Output as a String in ACT console?
From David Roche's TIG Post:
from Ansys.ACT.Core.Messages import *
Hi Ayush, can you add a bit more context to your question? It's not clear what sort of log output you're looking for here.
Hi James (@James Derrick) , Thanks for the feedback, added some context, I hope this clarifies the question!
That's great Ayush, thanks!
Is it possible to retrieve the count of error/warning messages in the log?
Let's say I use ExtAPI.Log.WriteError(...) several times in the code and I would like to know, how many times these error messages were written to the log.
@Josef Behal Log.Stream.ToString() is a string, you can save that in a variable and search for number of occurrences of a particular string. For example:
Yes, this is obvious. In this case, I need to write every time something like ExtAPI.Log.WriteError(Error, error message....) or somehow wrap this function.
Do I understand correctly that WriteError function just formats the text and does not add any object properties, for example as mechanical error message does?
@Josef Behal, that is correct. WriteError expects only a string argument. That argument is rendered as an Error message in ACT Log in red.
OK, thank you.