sparse-intern-71089
05/19/2021, 9:01 PMworried-city-86458
05/19/2021, 9:03 PMconfig.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 contextworried-city-86458
05/19/2021, 9:04 PMILogger<T>
instead of ILogger
where type T
becomes the source contextworried-city-86458
05/19/2021, 9:06 PMpublic 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; }
}
worried-city-86458
05/19/2021, 9:31 PMtall-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.worried-city-86458
05/20/2021, 11:00 AMworried-city-86458
05/20/2021, 11:05 AMworried-city-86458
05/20/2021, 11:11 AMworried-city-86458
05/20/2021, 11:13 AMPulumi.Deployment
so I can control it with say:
Serilog:
MinimumLevel:
Override:
Pulumi.Deployment: Debug
worried-city-86458
05/20/2021, 11:14 AMworried-city-86458
05/20/2021, 11:22 AMPulumi.Deployment