Skip to content

Conversation

@filzrev
Copy link
Contributor

@filzrev filzrev commented Jul 1, 2023

This PR change console log message format.
It ensure warning and error code is always included inside log message.

Purpose of this PR
Some IDEs have problem matcher features to distinguish warning/errors category from console output logs.

For Visual Studio. docfx's console output is almost compatible with VS standard format.
So this PR fix non compatible warnings/error message to VS compliant.

For example

From:
`Can't find the post processor: CustomPostProcessor` 
To:
`warning: Can't find the post processor: CustomPostProcessor`

Note
ConsoleLogListener directly use Console API. so unit tests is difficult to write.
I've confirmed it works as expected with VS debugging mode.

Visual Studio MSBuild integration image

Following code is example project to build and run docfx inside Visual Studio and dotnet command,

<Project Sdk="Microsoft.Build.NoTargets/3.7.0">
    <PropertyGroup>
        <TargetFramework>net7.0</TargetFramework>
    </PropertyGroup>
    
    <ItemGroup>
        <Content Include="**/*" Exclude="*.csproj"/>
    </ItemGroup>

    <!-- Add `Build` MSBuild target. -->
    <Target Name="RunDocfxBuild" AfterTargets="Build" >
        <Exec Command="run.bat"  WorkingDirectory="$(MSBuildThisFileDirectory)">
        </Exec>
    </Target>

    <!-- Customize `dotnet run` commands -->
    <PropertyGroup>
        <RunCommand>docfx</RunCommand>
        <RunArguments>serve _site</RunArguments>
        <RunWorkingDirectory>$(MSBuildThisFileDirectory)</RunWorkingDirectory>
    </PropertyGroup>
</Project>

Error List Results
image

@codecov
Copy link

codecov bot commented Jul 1, 2023

Codecov Report

Patch coverage: 40.00% and project coverage change: -0.02 ⚠️

Comparison is base (15e87e3) 77.06% compared to head (d3f7575) 77.04%.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #8916      +/-   ##
==========================================
- Coverage   77.06%   77.04%   -0.02%     
==========================================
  Files         605      605              
  Lines       25038    25042       +4     
==========================================
- Hits        19295    19294       -1     
- Misses       5743     5748       +5     
Impacted Files Coverage Δ
...oft.DocAsCode.Common/Loggers/ConsoleLogListener.cs 60.00% <40.00%> (-1.54%) ⬇️

... and 2 files with indirect coverage changes

☔ View full report in Codecov by Sentry.
📢 Do you have feedback about the report comment? Let us know in this issue.

Copy link
Contributor

@yufeih yufeih left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Indeed this includes log level for all cases. Thank you @filzrev !

@yufeih yufeih merged commit 1263a81 into dotnet:main Jul 2, 2023
@yufeih yufeih added the bug-fix Makes the pull request to appear in "Bug Fixes" section of the next release note label Jul 24, 2023
p-kostov pushed a commit to ErpNetDocs/docfx that referenced this pull request Jun 28, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug-fix Makes the pull request to appear in "Bug Fixes" section of the next release note

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants