+ Added "LogException", fixed some IFDEFs to correctly compile on mobile platforms

This commit is contained in:
Daniele Teti 2021-12-27 10:13:23 +01:00
parent 17cc5d5eea
commit f3e8def287
3 changed files with 36 additions and 37 deletions

View File

@ -437,23 +437,23 @@ The current beta release is named 3.2.2-nitrogen. If you want to stay on the-edg
- ⚡New! `MVCJSONRPCAllowGET` attribute allows a remote JSON-RPC published object, or a specific method, to be called using GET HTTP Verb as well as POST HTTP Verb. POST is always available, GET is available only if explicitly allowed. `IMVCJSONRPCExecutor` allows to specify which HTTP Verb to use when call the server JSON.RPC methods. The default verb can be injected in the constructor and each `ExecuteRequest`/`ExecuteNotification` allows to override od adhere to the instance default.
- Improved! Under some heavy load circumnstances the logger queue can get full. Now `TThreadSafeQueue` class uses a cubic function instead of a linear one to wait in case of very high concurrency. This allows a better resiliency in case of high load.
- Improved! Under some heavy load circumnstances the logger queue can get full. Now `TThreadSafeQueue` class uses a cubic function instead of a linear one to wait in case of very high concurrency. This allows a better resiliency in case of high load.
- Improved internal architecture of custom type serializers in case of dynamic linked packages.
- Improved internal architecture of custom type serializers in case of dynamic linked packages.
- ⚡New `TMVCLRUCache` implementation. Very efficient implementation of LRU cache borrowed directly from [DMSContainer](http://dmscontainer.bittimeprofessionals.com/)
- ⚡New! `TMVCActiveRecord` supports XML field type in PostgreSQL (in addition to JSON and JSONB).
- ⚡Improved! Add parameter to set local timeStamp as UTC.
- ✅ Improved! Added parameter to set local timeStamp as UTC.
- Improved OpenAPI (Swagger) support.
- Improved OpenAPI (Swagger) support.
- Improved! The unit tests fully test PostgreSQL, FirebirdSQL and SQLite while testing MVCActiveRecord framework. The other engines are tested using `activerecord_showcase` sample project.
- Improved! The unit tests fully test PostgreSQL, FirebirdSQL and SQLite while testing MVCActiveRecord framework. The other engines are tested using `activerecord_showcase` sample project.
- Improved! MVCActiveRecord doeas a better job to handle TDate/TTime/TDateTime types for SQLite (it is automatic because SQLite doesn't support date/time types).
- Improved! MVCActiveRecord doeas a better job to handle TDate/TTime/TDateTime types for SQLite (it is automatic because SQLite doesn't support date/time types).
- Improved! PostgreSQL, FirebirdSQL, Interbase and SQLite now support tablename and fields with spaces.
- Improved! PostgreSQL, FirebirdSQL, Interbase and SQLite now support tablename and fields with spaces.
- ⚡New! Mechanism to customize the JWT claims setup using the client request as suggested in [issue495](https://github.com/danieleteti/delphimvcframework/issues/495)
@ -463,7 +463,7 @@ The current beta release is named 3.2.2-nitrogen. If you want to stay on the-edg
- ⚡New! Added partitioning for `TMVCActiveRecord descendants` (more info ASAP)
- Improved! After a big refactoring (*"I love to delete code" -- cit. Daniele Teti*), support a new SQLGenerator is just 2 (two) methods away! Just as example, this is the current version of `TMVCSQLGeneratorPostgreSQL`
- Improved! After a big refactoring (*"I love to delete code" -- cit. Daniele Teti*), support a new SQLGenerator is just 2 (two) methods away! Just as example, this is the current version of `TMVCSQLGeneratorPostgreSQL`
```delphi
type
@ -488,9 +488,11 @@ The current beta release is named 3.2.2-nitrogen. If you want to stay on the-edg
- ⚡New! Added the new `MVCOwned` attribute which allows to auto-create nested objects in the deserialization phase. This will not change the current behavior, you ned to explocitly define a property (or a field) as `MVCOwned` to allows the serialization to create or destroy object for you.
- Improved! `Context.Data` property is now created on-demand using a lazy loading approach (expect an overall speed improvement).
- Improved! `Context.Data` property is now created on-demand using a lazy loading approach (expect an overall speed improvement).
- ⚡New! Added `ActiveRecordConnectionRegistry.AddDefaultConnection(const aConnetionDefName: String)`. The connection definition **must** be known by FireDAC. This method simplifies the most common scenario shown below.
- ✅ Added `LogException` function in `MVCFramework.Logger.pas` to easily log exception in standard way.
- ⚡ New! Added `ActiveRecordConnectionRegistry.AddDefaultConnection(const aConnetionDefName: String)`. The connection definition **must** be known by FireDAC. This method simplifies the most common scenario shown below.
```delphi
ActiveRecordConnectionRegistry.AddDefaultConnection('MyConDefName');
@ -628,7 +630,9 @@ The current beta release is named 3.2.2-nitrogen. If you want to stay on the-edg
- Fix https://github.com/danieleteti/delphimvcframework/issues/526 (Thanks to [David Moorhouse](https://github.com/fastbike))
- Fix *fileupload* sample
- Fixed *fileupload* sample
- Fixed an `IFDEF` compatibility problem on mobile platforms (Thanks to Marco Cotroneo)
## Older Releases

View File

@ -56,6 +56,9 @@ procedure LogW(AObject: TObject); overload;
procedure LogE(AMessage: string);
procedure Log(LogLevel: TLogLevel; const AMessage: string); overload;
procedure LogException(const E: Exception; const AMessage: String);
procedure LogEnterMethod(const AMethodName: string);
procedure LogExitMethod(const AMethodName: string);
@ -155,6 +158,11 @@ begin
Log.Error(AMessage, LOGGERPRO_TAG);
end;
procedure LogException(const E: Exception; const AMessage: String);
begin
LogE(E.ClassName + ': ' + AMessage);
end;
// procedure LogException(
// const AException: Exception;
// const AMessage: string);

View File

@ -1085,18 +1085,18 @@ uses
MVCFramework.Serializer.HTML, MVCFramework.Serializer.Abstract;
var
_IsShuttingDown: Int64 = 0;
_MVCGlobalActionParamsCache: TMVCStringObjectDictionary<TMVCActionParamCacheItem> = nil;
_HostingFramework: TMVCHostingFrameworkType = hftUnknown;
gIsShuttingDown: Int64 = 0;
gMVCGlobalActionParamsCache: TMVCStringObjectDictionary<TMVCActionParamCacheItem> = nil;
gHostingFramework: TMVCHostingFrameworkType = hftUnknown;
function IsShuttingDown: Boolean;
begin
Result := TInterlocked.Read(_IsShuttingDown) = 1
Result := TInterlocked.Read(gIsShuttingDown) = 1
end;
procedure EnterInShutdownState;
begin
TInterlocked.Add(_IsShuttingDown, 1);
TInterlocked.Add(gIsShuttingDown, 1);
end;
function CreateResponse(const StatusCode: UInt16; const ReasonString: string;
@ -1979,22 +1979,16 @@ begin
if FRequest.ClassType = TApacheRequest then
begin
Exit(hftApache);
end
else
begin
{$IFNDEF LINUX}
end;
{$ENDIF}
{$IFDEF MSWINDOWS}
if FRequest.ClassType = TISAPIRequest then
begin
Exit(hftISAPI);
end
else
end;
{$ENDIF}
{$ENDIF}
begin
Exit(hftIndy);
end;
end;
end;
{ MVCFromBodyAttribute }
@ -2333,7 +2327,7 @@ begin
try
DefineDefaultResponseHeaders(lContext);
lHandled := False;
lRouter := TMVCRouter.Create(FConfig, _MVCGlobalActionParamsCache);
lRouter := TMVCRouter.Create(FConfig, gMVCGlobalActionParamsCache);
try // finally
lSelectedController := nil;
try // only for lSelectedController
@ -4087,21 +4081,14 @@ begin
FFormat := AFormat;
end;
{ TMVCHackHTTPAppRequest }
// function TMVCHackHTTPAppRequest.GetHeaders: TStringList;
// begin
// Result := FRequestInfo.RawHeaders;
// end;
initialization
_IsShuttingDown := 0;
gIsShuttingDown := 0;
_MVCGlobalActionParamsCache := TMVCStringObjectDictionary<TMVCActionParamCacheItem>.Create;
gMVCGlobalActionParamsCache := TMVCStringObjectDictionary<TMVCActionParamCacheItem>.Create;
finalization
FreeAndNil(_MVCGlobalActionParamsCache);
FreeAndNil(gMVCGlobalActionParamsCache);
end.