Replace console writes with logging
This commit is contained in:
		
							parent
							
								
									19aefb6ac5
								
							
						
					
					
						commit
						2ecf17400e
					
				|  | @ -1,3 +1,5 @@ | ||||||
|  | using Serilog; | ||||||
|  | 
 | ||||||
| namespace KeepersCompound.LGS.Database.Chunks; | namespace KeepersCompound.LGS.Database.Chunks; | ||||||
| 
 | 
 | ||||||
| public record LinkId | public record LinkId | ||||||
|  | @ -96,7 +98,7 @@ public class LinkChunk : IChunk, IMergable | ||||||
|          |          | ||||||
|         if (links.Count != count) |         if (links.Count != count) | ||||||
|         { |         { | ||||||
|             Console.WriteLine($"Trimmed links: {count} -> {links.Count}"); |             Log.Information("Trimming excess Links in GAM: {StartCount} -> {EndCount}", count, links.Count); | ||||||
|         } |         } | ||||||
|          |          | ||||||
|         links.AddRange(((LinkChunk)other).links); |         links.AddRange(((LinkChunk)other).links); | ||||||
|  | @ -162,7 +164,7 @@ public class LinkDataMetaProp : IChunk, IMergable | ||||||
| 
 | 
 | ||||||
|         if (linkData.Count != count) |         if (linkData.Count != count) | ||||||
|         { |         { | ||||||
|             Console.WriteLine($"Trimmed link data: {count} -> {linkData.Count}"); |             Log.Information("Trimming excess LinkData in GAM: {StartCount} -> {EndCount}", count, linkData.Count); | ||||||
|         } |         } | ||||||
|          |          | ||||||
|         linkData.AddRange(((LinkDataMetaProp)other).linkData); |         linkData.AddRange(((LinkDataMetaProp)other).linkData); | ||||||
|  |  | ||||||
|  | @ -2,6 +2,7 @@ using System.Numerics; | ||||||
| using KeepersCompound.LGS; | using KeepersCompound.LGS; | ||||||
| using KeepersCompound.LGS.Database; | using KeepersCompound.LGS.Database; | ||||||
| using KeepersCompound.LGS.Database.Chunks; | using KeepersCompound.LGS.Database.Chunks; | ||||||
|  | using Serilog; | ||||||
| using TinyEmbree; | using TinyEmbree; | ||||||
| 
 | 
 | ||||||
| namespace KeepersCompound.Lightmapper; | namespace KeepersCompound.Lightmapper; | ||||||
|  | @ -191,10 +192,28 @@ public class LightMapper | ||||||
|             } |             } | ||||||
|         } |         } | ||||||
| 
 | 
 | ||||||
|         var infinite = _lights.Count(light => light.Radius == float.MaxValue); |         var infinite = 0; | ||||||
|  |         foreach (var light in _lights) | ||||||
|  |         { | ||||||
|  |             if (light.Radius != float.MaxValue) | ||||||
|  |             { | ||||||
|  |                 continue; | ||||||
|  |             } | ||||||
|  | 
 | ||||||
|  |             if (light.ObjId != -1) | ||||||
|  |             { | ||||||
|  |                 Log.Warning("Infinite light from object {Id}", light.ObjId); | ||||||
|  |             } | ||||||
|  |             else | ||||||
|  |             { | ||||||
|  |                 Log.Warning("Infinite light from brush near {Position}", light.Position); | ||||||
|  |             } | ||||||
|  |             infinite++; | ||||||
|  |         } | ||||||
|  |          | ||||||
|         if (infinite > 0) |         if (infinite > 0) | ||||||
|         { |         { | ||||||
|             Console.WriteLine($"WARNING: Infinite radius lights found: {infinite}/{_lights.Count}"); |             Log.Warning("Mission contains {Count} infinite lights", infinite); | ||||||
|         } |         } | ||||||
|     } |     } | ||||||
|      |      | ||||||
|  | @ -221,6 +240,7 @@ public class LightMapper | ||||||
|             R2 = float.MaxValue, |             R2 = float.MaxValue, | ||||||
|             LightTableIndex = lightTable.LightCount, |             LightTableIndex = lightTable.LightCount, | ||||||
|             SpotlightInnerAngle = -1f, |             SpotlightInnerAngle = -1f, | ||||||
|  |             ObjId = -1, | ||||||
|         }; |         }; | ||||||
|          |          | ||||||
|         _lights.Add(light); |         _lights.Add(light); | ||||||
|  | @ -483,7 +503,7 @@ public class LightMapper | ||||||
| 
 | 
 | ||||||
|             if (cell.LightIndexCount > 97) |             if (cell.LightIndexCount > 97) | ||||||
|             { |             { | ||||||
|                 // Console.WriteLine($"WARNING: Too many lights in cell at ({cell.SphereCenter}): {cell.LightIndexCount - 1} / 96"); |                 Log.Warning("Cell {Id} sees too many lights ({Count})", i, cell.LightIndices[0]); | ||||||
|             } |             } | ||||||
|         }); |         }); | ||||||
| 
 | 
 | ||||||
|  | @ -505,10 +525,10 @@ public class LightMapper | ||||||
| 
 | 
 | ||||||
|             if (overLit > 0) |             if (overLit > 0) | ||||||
|             { |             { | ||||||
|                 Console.WriteLine($"WARNING: Overlit cells detected: {overLit}/{worldRep.Cells.Length}"); |                 Log.Warning("{Count}/{CellCount} cells are overlit. Overlit cells can cause Object/Light Gem lighting issues.", overLit, worldRep.Cells.Length); | ||||||
|             } |             } | ||||||
| 
 | 
 | ||||||
|             Console.WriteLine($"MaxLights: {maxLights} / 96"); |             Log.Information("Max cell lights found ({Count}/96)", maxLights); | ||||||
|         } |         } | ||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
|  |  | ||||||
|  | @ -1,4 +1,5 @@ | ||||||
| using System.Diagnostics; | using System.Diagnostics; | ||||||
|  | using Serilog; | ||||||
| 
 | 
 | ||||||
| namespace KeepersCompound.Lightmapper; | namespace KeepersCompound.Lightmapper; | ||||||
| 
 | 
 | ||||||
|  | @ -32,7 +33,7 @@ public static class Timing | ||||||
|     { |     { | ||||||
|         foreach (var (stagename, time) in _stages) |         foreach (var (stagename, time) in _stages) | ||||||
|         { |         { | ||||||
|             Console.WriteLine($"[{stagename}]: {time:g}"); |             Log.Information("Timing {StageName}: {Time:g}", stagename, time); | ||||||
|         } |         } | ||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
|  |  | ||||||
		Loading…
	
		Reference in New Issue