private void InitSender(LoggerOptions options)
 {
     DebuggingLogger?.Debug("InitSender");
     sumoLogicMessageSender = new SumoLogicMessageSender(options.HttpMessageHandler, DebuggingLogger, "asp.net-core-logger")
     {
         Url = new Uri(options.Uri),
         ConnectionTimeout = options.ConnectionTimeout,
         RetryInterval     = options.RetryInterval
     };
     DebuggingLogger?.Debug("InitSender::Completed");
 }
 private void ReConfig(LoggerOptions options)
 {
     Dispose();
     if (string.IsNullOrWhiteSpace(options.Uri))
     {
         throw new ArgumentOutOfRangeException(nameof(options.Uri), $"{nameof(options.Uri)} cannot be empty.");
     }
     DebuggingLogger = options.DebuggingLogger != null ? new LoggerLog(options.DebuggingLogger) : null;
     InitSender(options);
     if (options.IsBuffered)
     {
         InitBuffer(options);
     }
     LoggerOptions = options;
 }
 public LoggerProvider(LoggerOptions options)
 {
     ReConfig(options);
 }
Ejemplo n.º 4
0
 /// <summary>
 /// Adds a Sumo Logic logger named 'SumoLogic' to the factory.
 /// </summary>
 /// <param name="builder">The <see cref="ILoggingBuilder"/> to use.</param>
 /// <param name="options">Configure an instance of the <see cref="LoggerOptions" /> to set logging options</param>
 public static ILoggingBuilder AddSumoLogic(this ILoggingBuilder builder, LoggerOptions options)
 {
     builder.Services.AddSingleton <ILoggerProvider>(new LoggerProvider(options));
     return(builder);
 }
Ejemplo n.º 5
0
 /// <summary>
 /// Adds the log4net logging provider.
 /// </summary>
 /// <param name="factory">The <see cref="ILoggerFactory"/> to use.</param>
 /// <param name="options">Configure an instance of the <see cref="LoggerOptions" /> to set logging options</param>
 public static ILoggerFactory AddSumoLogic(this ILoggerFactory factory, LoggerOptions options)
 {
     factory.AddProvider(new LoggerProvider(options));
     return(factory);
 }
 /// <summary>
 /// Adds a Sumo Logic logger named 'SumoLogic' to the factory.
 /// </summary>
 /// <param name="builder">The <see cref="ILoggingBuilder"/> to use.</param>
 /// <param name="options">Configure an instance of the <see cref="LoggerOptions" /> to set logging options</param>
 public static ILoggingBuilder AddSumoLogic(this ILoggingBuilder builder, LoggerOptions options)
 {
     builder.Services.AddSumoLogic(options);
     return(builder);
 }
 /// <summary>
 /// Adds a Sumo Logic logger named 'SumoLogic' to the service collection.
 /// </summary>
 /// <param name="services">The <see cref="IServiceCollection"/> to use.</param>
 /// <param name="options">Configure an instance of the <see cref="LoggerOptions" /> to set logging options</param>
 /// <param name="messageFormatter">Delegate to call when formatting and enhancing log message with log level and scope information. By Default uses <see cref="MessageFormatters.SimpleMessageFormatter"/>.</param>
 public static IServiceCollection AddSumoLogic(this IServiceCollection services, LoggerOptions options)
 {
     services.AddSingleton <ILoggerProvider>(new LoggerProvider(options));
     return(services);
 }