0

I would like to add to Serilog logs Function Name property. Function Name can be extracted from Execution Context which is available via Dependency Injection. And the best way to add it would be Enricher.

The only way that I find to use DI with Enrichers is by .UseSerilog but it can't be used in Azure Startup class.

So do you have any idea how this might be accomplished?

3
  • Are you already using Serilog in your function and only need to add Enricher? Or looking for complete fresh setup? Commented Sep 25, 2020 at 6:53
  • @KrishnenduGhosh-MSFT - we already configured Serilog, and we found that it would be good to have Function Name in logs. And from my understanding Enricher would be the best solution here. But we implement some new solution. Commented Sep 25, 2020 at 10:22
  • Ok. Can you post a little snippet of existing code on how you setup Serilog and also how you are using ILogger (if not default). Commented Sep 25, 2020 at 13:09

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.