public static void Report([NotNull] IIssueReporter @this, Exception exception) { @this.Report(new Issue { Exception = exception }); }
public ValidateLicenseCommand([NotNull] ILicenseDialog licenseDialog, [NotNull] IRemoteMetaData remoteMetaData, [NotNull] ILocalMetaData localMetaData, [NotNull] ICache cache, [NotNull] ILogger logger, [NotNull] IIssueReporter issueReporter) { if (licenseDialog == null) { throw new ArgumentNullException("licenseDialog"); } if (remoteMetaData == null) { throw new ArgumentNullException("remoteMetaData"); } if (localMetaData == null) { throw new ArgumentNullException("localMetaData"); } if (cache == null) { throw new ArgumentNullException("cache"); } if (logger == null) { throw new ArgumentNullException("logger"); } if (issueReporter == null) { throw new ArgumentNullException("issueReporter"); } _licenseDialog = licenseDialog; _remoteMetaData = remoteMetaData; _localMetaData = localMetaData; _cache = cache; _logger = logger; _issueReporter = issueReporter; }
private static void CompareSegmentAngles( [NotNull] IList <double> sourceAngles, [NotNull] IList <double> transformedAngles, double maxSegmentAngleDifferenceRadians, double ignoredAngleValue, [NotNull] IFeature transformedFeature, [NotNull] IPointCollection transformedPoints, [NotNull] IIssueReporter issueReporter) { Assert.AreEqual(sourceAngles.Count, transformedAngles.Count, "Differing number of segment angles. Source: {0} Transformed: {1}", sourceAngles.Count, transformedAngles.Count); var ignoredVertices = new List <int>(); var isClosedEvaluator = new IsClosedEvaluator(transformedPoints); int lastVertexIndex = sourceAngles.Count - 1; for (var vertexIndex = 0; vertexIndex <= lastVertexIndex; vertexIndex++) { double sourceAngle = sourceAngles[vertexIndex]; double transformedAngle = transformedAngles[vertexIndex]; if (Math.Abs(sourceAngle - ignoredAngleValue) < double.Epsilon) { ignoredVertices.Add(vertexIndex); continue; } double difference = Math.Abs(sourceAngle - transformedAngle); if (difference > maxSegmentAngleDifferenceRadians) { // ignore the angle difference if this is the last vertex, and its angle is // equal to the first vertex, and the points form a closed loop bool ignoreDifference = vertexIndex == lastVertexIndex && Math.Abs(transformedAngle - transformedAngles[0]) < double.Epsilon && isClosedEvaluator.IsClosed; if (!ignoreDifference) { IGeometry errorGeometry = GetErrorGeometry( vertexIndex, ignoredVertices, transformedPoints, isClosedEvaluator, sourceAngles, ignoredAngleValue); string description = string.Format( "Segment angle difference exceeds limit: {0}°", MathUtils.ToDegrees(difference)); issueReporter.Report(transformedFeature, errorGeometry, description); } } if (ignoredVertices.Count > 0) { ignoredVertices.Clear(); } } }
public static void Report([NotNull] IIssueReporter @this, string message, Exception exception) { @this.Report(new Issue { Message = message, Exception = exception }); }
public static void Report([NotNull] IIssueReporter @this, Exception exception, IDictionary <string, string> tags) { @this.Report(new Issue { Exception = exception, Tags = tags }); }
/// <summary> /// Initializes a new instance of the <see cref="SegmentAngleComparisonService"/> class. /// </summary> /// <param name="issueReporter">The issue reporter.</param> /// <param name="sourceFeatureClass">The source feature class.</param> /// <param name="maximumSegmentAngleDifferenceDegrees">The maximum segment angle difference in degrees.</param> /// <param name="maximumRoundingEffectRatio">The maximum rounding effect ratio.</param> public SegmentAngleComparisonService( [NotNull] IIssueReporter issueReporter, [NotNull] IFeatureClass sourceFeatureClass, double maximumSegmentAngleDifferenceDegrees, double maximumRoundingEffectRatio) { Assert.ArgumentNotNull(issueReporter, nameof(issueReporter)); Assert.ArgumentNotNull(sourceFeatureClass, nameof(sourceFeatureClass)); Assert.ArgumentCondition(maximumSegmentAngleDifferenceDegrees > 0, "maximum segment angle difference must be > 0"); Assert.ArgumentCondition(maximumRoundingEffectRatio > 0, "maximum rounding effect ratio must be > 0"); _issueReporter = issueReporter; _maximumSegmentAngleDifferenceRadians = MathUtils.ToRadians(maximumSegmentAngleDifferenceDegrees); _minimumSegmentLength = GetMinimumSegmentLength( sourceFeatureClass, _maximumSegmentAngleDifferenceRadians, maximumRoundingEffectRatio); }
public DiskSpaceManager(IDriveInfo driveInfo, IMonitorLogger logger, IIssueReporter issueReporter) { this.DriveInfo = driveInfo; this.Logger = logger; this.IssueReporter = issueReporter; }
public void SetupBeforeEachTest() { _fakeDriveInfo = Substitute.For <IDriveInfo>(); _issueReporter = Substitute.For <IIssueReporter>(); _logger = Substitute.For <IMonitorLogger>(); }
public AzureMonitorLogger(EnvironmentSetting environment, string harvesterId) { _issueReporter = YouTrackIssueConnector.GetInstance(environment); // Get the Instrumentation Key for Azure from an environment variable. string environmentVarName = "BloomHarvesterAzureAppInsightsKeyDev"; if (environment == EnvironmentSetting.Test) { environmentVarName = "BloomHarvesterAzureAppInsightsKeyTest"; } else if (environment == EnvironmentSetting.Prod) { environmentVarName = "BloomHarvesterAzureAppInsightsKeyProd"; } string instrumentationKey = Environment.GetEnvironmentVariable(environmentVarName); Debug.Assert(!String.IsNullOrWhiteSpace(instrumentationKey), "Azure Instrumentation Key is invalid. Azure logging probably won't work."); try { Microsoft.ApplicationInsights.Extensibility.TelemetryConfiguration.Active.InstrumentationKey = instrumentationKey; } catch (ArgumentNullException e) { _issueReporter.ReportException(e, $"InstrumentationKey: {instrumentationKey ?? "null"}.\nenvironmentVarName: {environmentVarName}", null); } _telemetry.Context.User.Id = "BloomHarvester " + harvesterId; _telemetry.Context.Session.Id = Guid.NewGuid().ToString(); _telemetry.Context.Device.OperatingSystem = Environment.OSVersion.ToString(); string logFilePath = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData), "BloomHarvester", "log.txt"); Console.Out.WriteLine("Creating log file at: " + logFilePath); try { if (File.Exists(logFilePath)) { // Check if the file is too big (~10 MB) if (new FileInfo(logFilePath).Length > 10000000) { var oldPath = logFilePath + "-OLD"; // Preserve one previous log file for debugging help, and start over with // an empty log file. // (The data is in Azure too anyway, but having it local may speed things up.) if (RobustFile.Exists(oldPath)) { RobustFile.Delete(oldPath); } RobustFile.Move(logFilePath, oldPath); } } } catch { // Doesn't matter if there are any errors } try { _fileLogger = new FileLogger(logFilePath); } catch { // That's unfortunate that creating the logger failed, but I don't really want to throw an exception since the file logger isn't even the main purpose of this calss. // Let's just replace it with something to get it to be quiet. _fileLogger = new NullLogger(); } }