Skip to content
This repository was archived by the owner on Oct 26, 2025. It is now read-only.

Commit 281c12d

Browse files
Add logging to file
1 parent fa790bf commit 281c12d

File tree

4 files changed

+10
-5
lines changed

4 files changed

+10
-5
lines changed

UnturnedMapMergeTool/Helpers/TilesHelper.cs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
using System;
22
using System.Collections.Generic;
33
using System.Linq;
4-
using UnturnedMapMergeTool.Models;
54
using UnturnedMapMergeTool.Models.Enums;
65
using UnturnedMapMergeTool.Unturned.Unity;
76

UnturnedMapMergeTool/Program.cs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,11 @@ private static void Main(string[] args)
1515
{
1616
Log.Logger = new LoggerConfiguration()
1717
.WriteTo.Console()
18+
.WriteTo.File("log.txt")
1819
.CreateLogger();
1920

21+
Log.Information($"UnturnedMapMergeTool v{typeof(Program).Assembly.GetName().Version} has been loaded!");
22+
2023
Config config;
2124
if (File.Exists("config.json"))
2225
{
@@ -110,6 +113,8 @@ private static void Main(string[] args)
110113
itemsDataMergeTool.CombineAndSaveData(outputMap);
111114
jarsDataMergeTool.CombineAndSaveData(outputMap);
112115

116+
Log.Information($"Finished migrating {config.Maps.Count} maps!");
117+
Log.Information("Press any key to exit the program...");
113118
Console.ReadKey();
114119
}
115120
}
Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
using System;
1+
using Serilog;
22
using UnturnedMapMergeTool.Models.Enums;
33

44
namespace UnturnedMapMergeTool.Services
@@ -7,12 +7,12 @@ public partial class CopyMap
77
{
88
private void LogTile(ETileType tileType, string message)
99
{
10-
Log($"[{tileType}] {message}");
10+
LogInformation($"[{tileType}] {message}");
1111
}
1212

13-
private void Log(string message)
13+
private void LogInformation(string message)
1414
{
15-
Console.WriteLine($"[{config.Name}]: {message}");
15+
Log.Information($"[{config.Name}]: {message}");
1616
}
1717
}
1818
}

UnturnedMapMergeTool/UnturnedMapMergeTool.csproj

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
<PackageReference Include="Newtonsoft.Json" Version="13.0.1" />
1010
<PackageReference Include="Serilog" Version="2.12.0" />
1111
<PackageReference Include="Serilog.Sinks.Console" Version="4.1.0" />
12+
<PackageReference Include="Serilog.Sinks.File" Version="5.0.0" />
1213
</ItemGroup>
1314

1415
<ItemGroup>

0 commit comments

Comments
 (0)