public InsightOpsSink(InsightOpsSinkSettings config, IFormatProvider formatProvider = null) { if (config is null) { throw new ArgumentNullException(nameof(config)); } _formatProvider = formatProvider; // Optional. ValidateToken(config.Token); _asyncLogger = new AsyncLogger(); _asyncLogger.setToken(config.Token); _asyncLogger.setRegion(config.Region); _asyncLogger.setUseSsl(config.UseSsl); // These options are more or less, not used. _asyncLogger.setDebug(config.Debug); _asyncLogger.setIsUsingDataHub(config.IsUsingDataHub); _asyncLogger.setDataHubAddr(config.DataHubAddress); _asyncLogger.setDataHubPort(config.DataHubPort); _asyncLogger.setUseHostName(config.LogHostname); _asyncLogger.setHostName(config.HostName); _asyncLogger.setLogID(config.LogID); }
/// <summary> /// Writes events logs to insightOps. /// </summary> /// <param name="loggerConfiguration">Logger sink configuration.</param> /// <param name="config">Configuration settings.</param> /// <param name="restrictedToMinimumLevel">The minimum level for events passed through the sink. Ignored when levelSwitch is specified.</param> /// <param name="formatProvider">Optional: Supplies culture-specific formatting information, or null.</param> /// <param name="levelSwitch">A switch allowing the pass-through minimum level to be changed at runtime.</param> /// <returns></returns> public static LoggerConfiguration InsightOps(this LoggerSinkConfiguration loggerConfiguration, InsightOpsSinkSettings config, LogEventLevel restrictedToMinimumLevel = LogEventLevel.Verbose, IFormatProvider formatProvider = null, LoggingLevelSwitch levelSwitch = null) { return(loggerConfiguration.Sink(new InsightOpsSink(config, formatProvider), restrictedToMinimumLevel, levelSwitch)); }