-
Notifications
You must be signed in to change notification settings - Fork 408
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[release/8.0-preview3] Add CTRL-C and working directory messages. (#2003
) * Add CTRL-C and working directory messages. * Added a lifecycle service. * Change log category. --------- Co-authored-by: Mitch Denny <midenn@microsoft.com>
- Loading branch information
1 parent
c7bb15f
commit 7ffc9ba
Showing
4 changed files
with
58 additions
and
20 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
// Licensed to the .NET Foundation under one or more agreements. | ||
// The .NET Foundation licenses this file to you under the MIT license. | ||
|
||
using Aspire.Hosting.Publishing; | ||
using Microsoft.Extensions.Configuration; | ||
using Microsoft.Extensions.Hosting; | ||
using Microsoft.Extensions.Logging; | ||
using Microsoft.Extensions.Options; | ||
|
||
namespace Aspire.Hosting; | ||
|
||
internal sealed class DistributedApplicationLifecycle(ILogger<DistributedApplication> logger, IConfiguration configuration, IOptions<PublishingOptions> publishingOptions) : IHostedLifecycleService | ||
{ | ||
public Task StartAsync(CancellationToken cancellationToken) | ||
{ | ||
_ = logger; | ||
_ = publishingOptions; | ||
return Task.CompletedTask; | ||
} | ||
|
||
public Task StartedAsync(CancellationToken cancellationToken) | ||
{ | ||
if (publishingOptions.Value.Publisher != "manifest") | ||
{ | ||
logger.LogInformation("Distributed application started. Press CTRL-C to stop."); | ||
} | ||
|
||
return Task.CompletedTask; | ||
} | ||
|
||
public Task StartingAsync(CancellationToken cancellationToken) | ||
{ | ||
if (publishingOptions.Value.Publisher != "manifest") | ||
{ | ||
logger.LogInformation("Distributed application starting."); | ||
logger.LogInformation("Application host directory is: {AppHostDirectory}", configuration["AppHost:Directory"]); | ||
} | ||
|
||
return Task.CompletedTask; | ||
} | ||
|
||
public Task StopAsync(CancellationToken cancellationToken) | ||
{ | ||
return Task.CompletedTask; | ||
} | ||
|
||
public Task StoppedAsync(CancellationToken cancellationToken) | ||
{ | ||
return Task.CompletedTask; | ||
} | ||
|
||
public Task StoppingAsync(CancellationToken cancellationToken) | ||
{ | ||
return Task.CompletedTask; | ||
} | ||
} |