Coded Workflow Built-in Services, Best Practices Question

Hello,

I noticed the documentation was recently updated at Studio - Coded Workflow and had a question about a new guideline.

Users are now encouraged to access coded workflow’s built in services through this method:


“Note: We recommend you to use the the Log , BuildClient , and RunWorkflow methods through the services class and their corresponding services, instead of using them as standalone, readily available methods.”

Why is services.OutputLoggerService.Log() preferential to just doing Log()? I want to better understand why this new guideline exists so I can get the most out of it.

Thanks, I appreciate the help.

Hi, @edevries

Good catch on that note in the docs.

Log() and services.OutputLoggerService.Log() end up doing the same thing today, but UiPath is standardizing everything around the ICodedWorkflowServices services entry point.

Using the service version makes the dependency explicit, plays nicely with the DI container nd gives UiPath room to extend or swap logging behavior later without changing your code.

So for new coded workflows it’s safer to follow the guideline and use:

services.OutputLoggerService.Log("message", LogLevel.Info);

instead of calling Log() directly.

1 Like

Thank you for the answer. I will start logging that way in my coded workflows. I only wish the documentation had more details.

1 Like

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.