Skip to content

Commit 1ddc436

Browse files
authored
add using statement to dispose loggerFactory to ensure logs are flushed properly (#35392)
1 parent 8a2cb26 commit 1ddc436

File tree

1 file changed

+1
-1
lines changed
  • docs/standard/commandline/snippets/dependency-injection/csharp

1 file changed

+1
-1
lines changed

docs/standard/commandline/snippets/dependency-injection/csharp/Program.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ protected override ILogger GetBoundValue(
4040

4141
ILogger GetLogger(BindingContext bindingContext)
4242
{
43-
ILoggerFactory loggerFactory = LoggerFactory.Create(
43+
using ILoggerFactory loggerFactory = LoggerFactory.Create(
4444
builder => builder.AddConsole());
4545
ILogger logger = loggerFactory.CreateLogger("LoggerCategory");
4646
return logger;

0 commit comments

Comments
 (0)