worried-city-86458
05/19/2021, 9:01 PMSourceContext
, which is used to configure logging per source.config.Development.yml
to configure logging:
Serilog:
MinimumLevel:
Override:
Microsoft: Information
Microsoft.Hosting.Lifetime: Warning
WriteTo:
- Name: Seq
Args:
serverUrl: <http://localhost:5341>
But I can't control the dotnet automation api logging without a source contextILogger<T>
instead of ILogger
where type T
becomes the source contextpublic sealed partial class DeployCommand : AsyncCommandBase<DeployCommand.Settings>
{
public DeployCommand(IOptions<Config> options, ILogger<DeployCommand> logger, IServiceProvider serviceProvider) : base(options, logger)
{
}
protected override async Task<int> OnExecuteAsync(CommandContext context, Settings settings)
{
Logger.LogInformation("Deploying resources...");
using var totalTimeLogger = new ElapsedTimeLogger(Logger, "Deployed resources");
...
}
}
public abstract class AsyncCommandBase<TSettings> : AsyncCommand<TSettings> where TSettings : CommandSettings
{
protected AsyncCommandBase(IOptions<Config> options, ILogger logger)
{
Config = options.Value;
Logger = logger;
}
protected Config Config { get; }
protected ILogger Logger { get; }
}
tall-librarian-49374
05/20/2021, 5:46 AMworried-city-86458
05/20/2021, 7:53 AMbored-oyster-3147
05/20/2021, 10:46 AMworried-city-86458
05/20/2021, 10:59 AMSerilog.Log.ForContext<Deployment>()
. It gets ugly when PULUMI_DOTNET_LOG_VERBOSE
is defined as this creates a new logger which wipes my sinks.Pulumi.Deployment
so I can control it with say:
Serilog:
MinimumLevel:
Override:
Pulumi.Deployment: Debug
Pulumi.Deployment