How to retrieve WB extensions Log Output as a String in ACT console?

Ayush Kumar
Ayush Kumar Member, Moderator, Employee Posts: 450
100 Answers 250 Likes 100 Comments First Anniversary
✭✭✭✭
edited December 2022 in General Language Questions

How to retrieve WB extensions Log Output as a String in ACT console?

enter image description here

Tagged:

Best Answer

Answers

  • James Derrick
    James Derrick Administrator, Employee Posts: 267
    Ancient Membership 100 Comments 100 Likes 25 Answers
    admin

    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.

  • Ayush Kumar
    Ayush Kumar Member, Moderator, Employee Posts: 450
    100 Answers 250 Likes 100 Comments First Anniversary
    ✭✭✭✭

    Hi James (@James Derrick) , Thanks for the feedback, added some context, I hope this clarifies the question!

  • James Derrick
    James Derrick Administrator, Employee Posts: 267
    Ancient Membership 100 Comments 100 Likes 25 Answers
    admin

    That's great Ayush, thanks!

  • Josef Behal
    Josef Behal Member Posts: 22
    10 Comments Name Dropper
    **

    Hi all,

    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.

  • Ayush Kumar
    Ayush Kumar Member, Moderator, Employee Posts: 450
    100 Answers 250 Likes 100 Comments First Anniversary
    ✭✭✭✭
    edited March 2023

    @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:


  • Josef Behal
    Josef Behal Member Posts: 22
    10 Comments Name Dropper
    **

    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?

  • Ayush Kumar
    Ayush Kumar Member, Moderator, Employee Posts: 450
    100 Answers 250 Likes 100 Comments First Anniversary
    ✭✭✭✭

    @Josef Behal, that is correct. WriteError expects only a string argument. That argument is rendered as an Error message in ACT Log in red.

  • Josef Behal
    Josef Behal Member Posts: 22
    10 Comments Name Dropper
    **

    OK, thank you.