diff --git a/src/core/AutoRest.Core/Logging/ConsoleLogListener.cs b/src/core/AutoRest.Core/Logging/ConsoleLogListener.cs index 25398bc0a0..4e53c92716 100644 --- a/src/core/AutoRest.Core/Logging/ConsoleLogListener.cs +++ b/src/core/AutoRest.Core/Logging/ConsoleLogListener.cs @@ -55,7 +55,7 @@ public void Log(LogMessage message) targetStream.WriteLine($"{message.Severity.ToString().ToUpperInvariant()}: {message.Message}"); if (message.Path != null) { - targetStream.WriteLine($"\tPath: {message.Path.XPath}"); + targetStream.WriteLine($"\tPath: {message.Path.ReadablePath}"); } if (message.VerboseData != null) { diff --git a/src/core/AutoRest.Core/Logging/ObjectPath.cs b/src/core/AutoRest.Core/Logging/ObjectPath.cs index 045d674c6c..c8c6fc81e3 100644 --- a/src/core/AutoRest.Core/Logging/ObjectPath.cs +++ b/src/core/AutoRest.Core/Logging/ObjectPath.cs @@ -30,6 +30,8 @@ private ObjectPath(IEnumerable path) public string XPath => "#" + string.Concat(Path.Select(p => p.XPath)); + public string ReadablePath => "#" + string.Concat(Path.Select(p => p.ReadablePath)); + public YamlNode SelectNode(YamlNode node) { YamlNode result = node; diff --git a/src/core/AutoRest.Core/Logging/ObjectPathPart.cs b/src/core/AutoRest.Core/Logging/ObjectPathPart.cs index 8e0dbb6c55..9a84112fb5 100644 --- a/src/core/AutoRest.Core/Logging/ObjectPathPart.cs +++ b/src/core/AutoRest.Core/Logging/ObjectPathPart.cs @@ -9,6 +9,8 @@ public abstract class ObjectPathPart { public abstract string XPath { get; } + public abstract string ReadablePath { get; } + /// /// Selects the child node according to this path part. /// Returns null if such node was not found. diff --git a/src/core/AutoRest.Core/Logging/ObjectPathPartIndex.cs b/src/core/AutoRest.Core/Logging/ObjectPathPartIndex.cs index d21e2056ce..2f75de1e93 100644 --- a/src/core/AutoRest.Core/Logging/ObjectPathPartIndex.cs +++ b/src/core/AutoRest.Core/Logging/ObjectPathPartIndex.cs @@ -19,6 +19,8 @@ public ObjectPathPartIndex(int index) public override string XPath => $"[{Index + 1}]"; + public override string ReadablePath => XPath; + public override YamlNode SelectNode(ref YamlNode node) { var snode = node as YamlSequenceNode; diff --git a/src/core/AutoRest.Core/Logging/ObjectPathPartProperty.cs b/src/core/AutoRest.Core/Logging/ObjectPathPartProperty.cs index b983886fad..f263d2aea8 100644 --- a/src/core/AutoRest.Core/Logging/ObjectPathPartProperty.cs +++ b/src/core/AutoRest.Core/Logging/ObjectPathPartProperty.cs @@ -21,6 +21,8 @@ public ObjectPathPartProperty(string property) public override string XPath => $"/{SanitizeXPathProperty(Property)}"; + public override string ReadablePath => Property.StartsWith("/") ? Property : $"/{Property}"; + public override YamlNode SelectNode(ref YamlNode node) { var child = (node as YamlMappingNode)?.