|
2 | 2 | using System.Collections.Generic; |
3 | 3 | using System.Diagnostics; |
4 | 4 | using System.Linq; |
| 5 | +using Serilog; |
| 6 | +using Yafc.UI; |
5 | 7 |
|
6 | 8 | namespace Yafc.Model { |
7 | 9 | public class Milestones : Analysis { |
8 | 10 | public static readonly Milestones Instance = new Milestones(); |
9 | 11 |
|
| 12 | + private static readonly ILogger logger = Logging.GetLogger<Milestones>(); |
| 13 | + |
10 | 14 | public FactorioObject[] currentMilestones = []; |
11 | 15 | private Mapping<FactorioObject, Bits> milestoneResult; |
12 | 16 | public Bits lockedMask { get; private set; } = new(); |
@@ -170,7 +174,7 @@ public void ComputeWithParameters(Project project, ErrorCollector warnings, Fact |
170 | 174 | Array.Resize(ref currentMilestones, nextMilestoneIndex); |
171 | 175 | break; |
172 | 176 | } |
173 | | - Console.WriteLine("Processing milestone " + milestone.locName); |
| 177 | + logger.Information("Processing milestone {Milestone}", milestone.locName); |
174 | 178 | processingQueue.Enqueue(milestone.id); |
175 | 179 | processing[milestone] = ProcessingFlags.Initial | ProcessingFlags.InQueue; |
176 | 180 | } |
@@ -228,7 +232,7 @@ public void ComputeWithParameters(Project project, ErrorCollector warnings, Fact |
228 | 232 |
|
229 | 233 | accessibleObjects++; |
230 | 234 | //var obj = Database.objects[elem]; |
231 | | - //Console.WriteLine("Added object " + obj.locName + " [" + obj.GetType().Name + "] with mask " + elementFlags.ToString() + " (was " + cur.ToString() + ")"); |
| 235 | + //logger.Information("Added object {LocalizedName} [{Type}] with mask {MilestoneMask} (was {PreviousMask})", obj.locName, obj.GetType().Name, elementFlags, cur); |
232 | 236 | if (processing[elem] == ProcessingFlags.MilestoneNeedOrdering) { |
233 | 237 | processing[elem] = 0; |
234 | 238 | elementFlags |= nextMilestoneMask; |
@@ -270,7 +274,7 @@ public void ComputeWithParameters(Project project, ErrorCollector warnings, Fact |
270 | 274 | warnings.Error("There are some milestones that are not accessible: " + string.Join(", ", milestonesNotReachable.Select(x => x.locName)) + ". You may remove these from milestone list," + |
271 | 275 | MaybeBug + MilestoneAnalysisIsImportant + UseDependencyExplorer, ErrorSeverity.AnalysisWarning); |
272 | 276 | } |
273 | | - Console.WriteLine("Milestones calculation finished in " + time.ElapsedMilliseconds + " ms."); |
| 277 | + logger.Information("Milestones calculation finished in {ElapsedTime}ms.", time.ElapsedMilliseconds); |
274 | 278 | milestoneResult = result; |
275 | 279 | } |
276 | 280 |
|
|
0 commit comments