How to get the value from info log?

Hello,

I am writing an automation. However, the system prompt infolog (info,warning, or error), I would like to catch all the text and store it. Any hint to capture the text on infolog?

Thanks in advance

for (i=1; i<=infolog.line(); i++)

{

messageBody += infolog.text(i);

}

Thank you. It works.