-
Notifications
You must be signed in to change notification settings - Fork 879
Open
Description
Describe the bug
docfx record logs at following lines.
docfx/src/docfx/Models/CommandHelper.cs
Lines 28 to 36 in 3e660da
| public static int Run(LogOptions options, Action run) | |
| { | |
| SetupLogger(options); | |
| run(); | |
| CleanupLogger(); | |
| return Logger.HasError ? -1 : 0; | |
| } |
But when exception thrown.
Cleanup is not called. and when using --log option. log is not properly because ReportLogListener using StreamWriter and need Flush before exit.
Additionally, Exception information seems be outputted to console only. and it's not recorded to log file.
Lines 40 to 62 in 3e660da
| static void OnException(Exception e, ITypeResolver? resolver) | |
| { | |
| if (e is CommandAppException cae) | |
| { | |
| if (cae.Pretty is { } pretty) | |
| AnsiConsole.Write(pretty); | |
| else | |
| AnsiConsole.MarkupInterpolated($"[red]Error:[/] {e.Message}"); | |
| } | |
| else | |
| { | |
| AnsiConsole.WriteException(e, new ExceptionSettings() | |
| { | |
| Format = ExceptionFormats.ShortenEverything, | |
| Style = new() | |
| { | |
| ParameterName = Color.Grey, | |
| ParameterType = Color.Grey78, | |
| LineNumber = Color.Grey78, | |
| }, | |
| }); | |
| } | |
| } |
Expected behavior
- All logs are recorded to log file.
- thrown exception information is included.
Metadata
Metadata
Assignees
Labels
No labels