Year: 2021

Log levels – Logging patterns

In the previous examples, we used the LogInformation method to log information messages, but there are other levels as well, shown in the following table: Level Method Description Production Trace LogTrace This is used to capture detailed information about the program, instrument execution speed, and debugging. You can also log sensitive information when using traces. […]

Writing logs – Logging patterns-2

In the Act phase, we call the Execute method of our service. This method logs a line to the ILogger implementation that is injected upon instantiation. Then, we assert that the line was written in the lines list (that’s what AssertableLogger does; it writes to a List<string>). In an ASP.NET Core application, all that logging […]

Writing logs – Logging patterns-1

First, the logging system is provider-based, meaning we must register one or more ILoggerProvider instances if we want our log entries to go somewhere. By default, when calling WebApplication.CreateBuilder(args), it registers the Console, Debug, EventSource, and EventLog (Windows only) providers, but we can modify this list. You can add and remove providers if you need […]

About logging – Logging patterns

Before you begin: Join our book community on Discord Give your feedback straight to the author himself and chat to other early readers on our Discord server (find the “architecting-aspnet-core-apps-3e” channel under EARLY ACCESS SUBSCRIPTION). https://packt.link/EarlyAccess This chapter covers a .NET-specific feature and closes the Designing for ASP.NET Core section. The logging feature that comes […]



          Copyright © 2015-2024 | About | Terms of Service | Privacy Policy