Skip to content

Commit 31e52c4

Browse files
committed
shore(logging): enhance logging to include assembly name and version along with options parameters
1 parent d8a69ff commit 31e52c4

File tree

2 files changed

+24
-2
lines changed

2 files changed

+24
-2
lines changed

XMLDiff/Program.cs

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1-
using System.Text.RegularExpressions;
1+
using System.Reflection;
2+
using System.Text.RegularExpressions;
23
using System.Xml;
34
using System.Xml.Linq;
45
using System.Xml.Schema;
@@ -23,7 +24,16 @@ static void Main(string[] args)
2324
private static void RunOptionsAndReturnExitCode(Options opts)
2425
{
2526
ConfigureLogging(opts.LogToFile, opts.AppendToLog);
27+
Assembly assembly = Assembly.GetExecutingAssembly();
28+
AssemblyName assemblyName = assembly.GetName();
2629

30+
Logger.Info($"Running {assemblyName.Name} v{assemblyName.Version}");
31+
string param = "";
32+
foreach (var prop in typeof(Options).GetProperties())
33+
{
34+
param += (string.IsNullOrEmpty(param) ? "" : ", ") + $"{prop.Name}: '{prop.GetValue(opts)}'";
35+
}
36+
Logger.Info($"Parameters: {param}");
2737
var originalXmlPath = opts.OriginalXml;
2838
var modifiedXmlPath = opts.ModifiedXml;
2939
var diffXmlPath = opts.DiffXml;

XMLPatch/Program.cs

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1-
using System.Text.RegularExpressions;
1+
using System.Reflection;
2+
using System.Text.RegularExpressions;
23
using System.Xml;
34
using System.Xml.Linq;
45
using System.Xml.Schema;
@@ -24,6 +25,17 @@ private static void RunOptionsAndReturnExitCode(Options opts)
2425
{
2526
ConfigureLogging(opts.LogToFile, opts.AppendToLog);
2627

28+
Assembly assembly = Assembly.GetExecutingAssembly();
29+
AssemblyName assemblyName = assembly.GetName();
30+
31+
Logger.Info($"Running {assemblyName.Name} v{assemblyName.Version}");
32+
string param = "";
33+
foreach (var prop in typeof(Options).GetProperties())
34+
{
35+
param += (string.IsNullOrEmpty(param) ? "" : ", ") + $"{prop.Name}: '{prop.GetValue(opts)}'";
36+
}
37+
Logger.Info($"Parameters: {param}");
38+
2739
var originalXmlPath = opts.OriginalXml;
2840
var diffXmlPath = opts.DiffXml;
2941
var outputXmlPath = opts.OutputXml;

0 commit comments

Comments
 (0)