Skip to content

Commit 295b411

Browse files
Rick van DamFrankBakkerNl
andauthored
Log how many applications where loaded and what state they are in after loading is completed (#924)
Co-authored-by: Frank Bakker <[email protected]>
1 parent 9f5b3ab commit 295b411

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

src/AppModel/NetDaemon.AppModel/Internal/AppModelContext.cs

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,13 +9,15 @@ internal class AppModelContext : IAppModelContext
99
private readonly IEnumerable<IAppFactoryProvider> _appFactoryProviders;
1010
private readonly IServiceProvider _provider;
1111
private readonly FocusFilter _focusFilter;
12+
private ILogger<AppModelContext> _logger;
1213
private bool _isDisposed;
1314

14-
public AppModelContext(IEnumerable<IAppFactoryProvider> appFactoryProviders, IServiceProvider provider, FocusFilter focusFilter)
15+
public AppModelContext(IEnumerable<IAppFactoryProvider> appFactoryProviders, IServiceProvider provider, FocusFilter focusFilter, ILogger<AppModelContext> logger)
1516
{
1617
_appFactoryProviders = appFactoryProviders;
1718
_provider = provider;
1819
_focusFilter = focusFilter;
20+
_logger = logger;
1921
}
2022

2123
public IReadOnlyCollection<IApplication> Applications => _applications;
@@ -32,6 +34,9 @@ public async Task InitializeAsync(CancellationToken cancellationToken)
3234
await app.InitializeAsync().ConfigureAwait(false);
3335
_applications.Add(app);
3436
}
37+
38+
_logger.LogInformation("Finished loading applications: {state}",
39+
string.Join(", ", Enum.GetValues<ApplicationState>().Select(possibleState => $"{possibleState} {_applications.Count(app => app.State == possibleState)}")));
3540
}
3641

3742
public async ValueTask DisposeAsync()

0 commit comments

Comments
 (0)