Exemple #1
0
 /// <summary>
 /// Accepts any configuration that is a <see cref="ConsoleConfiguration"/>.
 /// </summary>
 /// <param name="m">The monitor to use.</param>
 /// <param name="c">The configuration.</param>
 /// <returns>True if <paramref name="c"/> is a ConsoleConfiguration.</returns>
 public ValueTask <bool> ApplyConfigurationAsync(IActivityMonitor m, IHandlerConfiguration c)
 {
     if (c is not ConsoleConfiguration cf)
     {
         return(ValueTask.FromResult(false));
     }
     _config = cf;
     return(ValueTask.FromResult(true));
 }
Exemple #2
0
 /// <summary>
 /// Initializes a new console handler.
 /// </summary>
 /// <param name="config">The configuration.</param>
 public Console(ConsoleConfiguration config)
 {
     _config = config ?? throw new ArgumentNullException("config");
     _buffer = new StringBuilder();
     if (string.IsNullOrWhiteSpace(config.DateFormat))
     {
         _builder = new MulticastLogEntryTextBuilder(config.UseDeltaTime, true);
     }
     else
     {
         _builder = new MulticastLogEntryTextBuilder(config.DateFormat, config.UseDeltaTime);
     }
 }