Better visibility for WARNINGS in Console logger

This commit is contained in:
Daniele Teti 2024-05-16 15:50:37 +02:00
parent 1a10545794
commit 4c5441d5e4
3 changed files with 37 additions and 23 deletions

View File

@ -997,8 +997,30 @@ begin
.AppendLine(' // When MVCSerializeNulls = True empty nullables and nil are serialized as json null.')
.AppendLine(' // When MVCSerializeNulls = False empty nullables and nil are not serialized at all.')
.AppendLine(' MVCSerializeNulls := True;')
.AppendLine(' UseConsoleLogger := True;');
.AppendLine(' UseConsoleLogger := True;')
.AppendLine
.AppendLine(' LogI(''** DMVCFramework Server ** build '' + DMVCFRAMEWORK_VERSION);');
if Model.B[TConfigKey.program_dotenv] then
begin
Section
.AppendLine
.AppendLine(' dotEnvConfigure(')
.AppendLine(' function: IMVCDotEnv')
.AppendLine(' begin')
.AppendLine(' Result := NewDotEnv')
.AppendLine(' .UseStrategy(TMVCDotEnvPriority.FileThenEnv)')
.AppendLine(' //if available, by default, loads default environment (.env)')
.AppendLine(' .UseProfile(''test'') //if available loads the test environment (.env.test)')
.AppendLine(' .UseProfile(''prod'') //if available loads the prod environment (.env.prod)')
.AppendLine(' .UseLogger(procedure(LogItem: String)')
.AppendLine(' begin')
.AppendLine(' LogD(''dotEnv: '' + LogItem);')
.AppendLine(' end)')
.AppendLine(' .Build(); //uses the executable folder to look for .env* files')
.AppendLine(' end);')
.AppendLine;
end;
if Model.B[TConfigKey.program_sqids] then
begin
@ -1010,30 +1032,10 @@ begin
Section
.AppendLine
.AppendLine(' LogI(''** DMVCFramework Server ** build '' + DMVCFRAMEWORK_VERSION);')
.AppendLine(' try')
.AppendLine(' if WebRequestHandler <> nil then')
.AppendLine(' WebRequestHandler.WebModuleClass := WebModuleClass;')
.AppendLine;
if Model.B[TConfigKey.program_dotenv] then
begin
Section
.AppendLine(' dotEnvConfigure(')
.AppendLine(' function: IMVCDotEnv')
.AppendLine(' begin')
.AppendLine(' Result := NewDotEnv')
.AppendLine(' .UseStrategy(TMVCDotEnvPriority.FileThenEnv)')
.AppendLine(' //if available, by default, loads default environment (.env)')
.AppendLine(' .UseProfile(''test'') //if available loads the test environment (.env.test)')
.AppendLine(' .UseProfile(''prod'') //if available loads the prod environment (.env.prod)')
.AppendLine(' .UseLogger(procedure(LogItem: String)')
.AppendLine(' begin')
.AppendLine(' LogD(''dotEnv: '' + LogItem);')
.AppendLine(' end)')
.AppendLine(' .Build(); //uses the executable folder to look for .env* files')
.AppendLine(' end);')
.AppendLine;
end;
Section
.AppendLine(' WebRequestHandlerProc.MaxConnections := dotEnv.Env(''dmvc.handler.max_connections'', 1024);')
.AppendLine

View File

@ -139,8 +139,8 @@ end;
procedure TLoggerProConsoleAppender.SetupColorMappings;
begin
fColors[TLogType.Debug] := FOREGROUND_GREEN;
fColors[TLogType.Info] := FOREGROUND_BLUE or FOREGROUND_GREEN or FOREGROUND_RED;
fColors[TLogType.Warning] := FOREGROUND_RED or FOREGROUND_GREEN or FOREGROUND_INTENSITY;
fColors[TLogType.Info] := FOREGROUND_BLUE or FOREGROUND_GREEN or FOREGROUND_RED or FOREGROUND_INTENSITY;
fColors[TLogType.Warning] := FOREGROUND_RED or FOREGROUND_GREEN;
fColors[TLogType.Error] := FOREGROUND_RED or FOREGROUND_INTENSITY;
fColors[TLogType.Fatal] := FOREGROUND_RED or FOREGROUND_BLUE or FOREGROUND_INTENSITY;
end;

View File

@ -422,6 +422,7 @@ type
FPropTime: TTime;
FPropCurrency: Currency;
fPropJSONObject: TJSONObject;
FPropIntegerSqids: Integer;
procedure SetPropAnsiString(const Value: AnsiString);
procedure SetPropString(const Value: string);
procedure SetPropInt64(const Value: Int64);
@ -455,6 +456,10 @@ type
property PropTimeStamp: TTimeStamp read FPropTimeStamp write SetPropTimeStamp;
property PropCurrency: Currency read FPropCurrency write SetPropCurrency;
property PropJSONObject: TJSONObject read fPropJSONObject;
{sqids}
[MVCSerializeAsSqids]
property PropIntegerSqids: Integer read FPropIntegerSqids write FPropIntegerSqids;
end;
TMyChildObject = class
@ -812,6 +817,9 @@ begin
Result.PropJSONObject.O['objprop'].S['innerprop1'] := 'value1';
Result.PropJSONObject.O['objprop'].S['innerprop2'] := 'value2';
Result.PropJSONObject.O['objprop'].S['innerprop3'] := 'value3';
{sqids}
Result.PropIntegerSqids := 1234;
end;
constructor TMyObject.Create;
@ -850,6 +858,10 @@ begin
lMyStr := Self.fPropJSONObject.ToJSON();
lOtherStr := Obj.PropJSONObject.ToJSON();
Result := Result and (Self.fPropJSONObject.ToJSON() = Obj.PropJSONObject.ToJSON());
{sqids}
Result := Result and (Self.PropIntegerSqids = Obj.PropIntegerSqids);
end;
procedure TMyObject.SetPropAnsiString(const Value: AnsiString);