docfx icon indicating copy to clipboard operation
docfx copied to clipboard

Provide line for warnings and errors

Open pascalberger opened this issue 9 years ago • 2 comments

Title

If a warning or error occurs, provide the line in the source file of the issue.

Functional impact

Providing the line of warnings and errors would increase possibilities for further processing of the log file generated by DocFx. With the filename / line information a build script could for example write warnings back to pull requests on the correct place.

Minimal repro steps

run docfx build -l output.log

Expected result

It would be nice to also recieve the line inside the file where the error ocurred like this:

{"message":"Invalid cross reference \"[Foo](xref:foo)\".","source":"Build Document.LinkPhaseHandler.Apply Templates","file":"index.md","line":"42","date_time":"2017-05-12T11:31:13.5247361Z","message_severity":"warning"} 

Actual result

A warning currently looks like this in the written log file:

{"message":"Invalid cross reference \"[Foo](xref:foo)\".","source":"Build Document.LinkPhaseHandler.Apply Templates","file":"index.md","date_time":"2017-05-12T11:31:13.5247361Z","message_severity":"warning"} 

pascalberger avatar May 12 '17 11:05 pascalberger

Docfx can log warning with line via LogWarning Method, and for this cross reference case, we can add logic to indicate line numbers in CrossReferenceNotResolvedException

hellosnow avatar May 16 '17 03:05 hellosnow

@pascalberger we've added the line number info via #1722 , closed for now.

hellosnow avatar Jun 08 '17 10:06 hellosnow