DevOps Articles

Curated articles, resources, tips and trends from the DevOps World.

How to Use LoggerFactory and Microsoft.Extensions.Logging for .NET Core Log

1 year ago stackify.com
How to Use LoggerFactory and Microsoft.Extensions.Logging for .NET Core Log

Summary: This is a summary of an article originally published by Stackify. Read the full original article here →

Do you use.NET (formerly.NET Core)? If so, you’re probably familiar with the built-in https://docs.microsoft.com/en-us/aspnet/core/fundamentals/logging which is in Microsoft.Extensions.Logging.

These are the topics we’ll cover: Basics of the.NET Core Logging With LoggerFactory

public class ValuesController : Controller { private ILoggerFactory _Factory; private ILogger _Logger; //set by dependency injection public ValuesController(ILoggerFactory factory, ILogger logger) { _Factory = factory; _Logger = logger; }

Both NLog and Serilog both have a provider that you can use to extend the functionality of the built-in logging API.

Made with pure grit © 2024 Jetpack Labs Inc. All rights reserved. www.jetpacklabs.com