-
Notifications
You must be signed in to change notification settings - Fork 319
Open
Labels
Description
What?
Dab validate should only show problems: Warnings or Errors. Also, incorrect output string.
- Never show
informationexcept in the preamble and "Config is valid" at the end. - Do not print enum.ToString(), instead use standard output strings.
Apologies to @RubenCerna2079 who tried to explain this to me earlier.
Standarize Log Level output strings
DAB
data-api-builder/src/Cli/CustomLoggerProvider.cs
Lines 62 to 77 in 9563a20
| public void Log<TState>(LogLevel logLevel, EventId eventId, TState state, Exception? exception, Func<TState, Exception?, string> formatter) | |
| { | |
| if (!IsEnabled(logLevel) || logLevel < _minimumLogLevel) | |
| { | |
| return; | |
| } | |
| ConsoleColor originalForeGroundColor = Console.ForegroundColor; | |
| ConsoleColor originalBackGroundColor = Console.BackgroundColor; | |
| Console.ForegroundColor = _logLevelToForeGroundConsoleColorMap[logLevel]; | |
| Console.BackgroundColor = _logLevelToBackGroundConsoleColorMap[logLevel]; | |
| Console.Write($"{logLevel}:"); | |
| Console.ForegroundColor = originalForeGroundColor; | |
| Console.BackgroundColor = originalBackGroundColor; | |
| Console.WriteLine($" {formatter(state, exception)}"); | |
| } |
Actual output
C:\Temp\dab-todo-test>dab validate
Information: Microsoft.DataApiBuilder 2.0.0
Information: Config not provided. Trying to get default config based on DAB_ENVIRONMENT...
Information: Environment variable DAB_ENVIRONMENT is Development
Information: Validating config file: dab-config.json
Information: The config satisfies the schema requirements.
Information: Validating entity relationships.
Information: [Todo] REST path: /api//Todo
Information: [MarkTodoComplete] REST path: /api//MarkTodoComplete
Information: Config is valid.
Desired output
valid
C:\Temp\dab-todo-test>dab validate
info: Microsoft.DataApiBuilder 2.0.0
info: Validating config file: dab-config.json
info: Config is invalid.
invalid
C:\Temp\dab-todo-test>dab validate
info: Microsoft.DataApiBuilder 2.0.0
info: Validating config file: dab-config.json
fail: {whatever is found wrong message here}
info: Config is valid.

Reactions are currently unavailable