Example #1
0
 /// <summary>
 /// Constructs a new formatter which uses the specified monitor to retrieve
 /// options and watch for options changes.
 /// </summary>
 /// <param name="optionsMonitor">The monitor to observe for changes in options. Must not be null.</param>
 public GoogleCloudConsoleFormatter(IOptionsMonitor <GoogleCloudConsoleFormatterOptions> optionsMonitor)
     : this(optionsMonitor.CurrentValue)
 {
     _optionsReloadToken = optionsMonitor.OnChange(options => _options = options);
 }
 private static GoogleCloudConsoleFormatter CreateFormatter(GoogleCloudConsoleFormatterOptions options = null)
 {
     options ??= new GoogleCloudConsoleFormatterOptions();
     return(new GoogleCloudConsoleFormatter(options));
 }
Example #3
0
 /// <summary>
 /// Constructor accepting just an options, to simplify testing.
 /// </summary>
 /// <param name="options">The formatter options. Must not be null.</param>
 internal GoogleCloudConsoleFormatter(GoogleCloudConsoleFormatterOptions options)
     : base(nameof(GoogleCloudConsoleFormatter))
 {
     _options            = options ?? throw new ArgumentNullException(nameof(options));
     _optionsReloadToken = null;
 }