diff --git a/.gitignore b/.gitignore index f29ed4be..6e67d178 100644 --- a/.gitignore +++ b/.gitignore @@ -99,3 +99,4 @@ unittests/general/Several/Win32/CONSOLE/sqlitetest.db unittests/general/Several/Win32/GUI/sqlitetest.db *.db-journal *.txaPackage +unittests/general/Several/bin/sqlitetest.db diff --git a/lib/loggerpro/Delphinus.Info.json b/lib/loggerpro/Delphinus.Info.json deleted file mode 100644 index 9d5ff665..00000000 --- a/lib/loggerpro/Delphinus.Info.json +++ /dev/null @@ -1,11 +0,0 @@ -{ - "id": "{E35C7797-DC25-4F38-95B7-5D7133D85A2F}", - "name": "LoggerPro", - "license_type": "Apache 2.0", - "license_file": "LICENSE", - "platforms": "Win32;Win64", - "package_compiler_min": 23, - "package_compiler_max": 32, - "compiler_min": 23, - "compiler_max": 32 -} \ No newline at end of file diff --git a/lib/loggerpro/Delphinus.Install.json b/lib/loggerpro/Delphinus.Install.json deleted file mode 100644 index c96bcedf..00000000 --- a/lib/loggerpro/Delphinus.Install.json +++ /dev/null @@ -1,25 +0,0 @@ -{ - "search_pathes": [{ - "pathes": ".", - "platforms": "Win32;Win64" - }], - "browsing_pathes": [{ - "pathes": ".", - "platforms": "Win32;Win64" - }], - "source_folders": [{ - "folder": "." - }, - { - "folder": "docs", - "recursive": true - }, - { - "folder": "samples", - "recursive": true - }, - { - "folder": "unittests", - "recursive": true - }] -} \ No newline at end of file diff --git a/lib/loggerpro/LOGGERPRO-BUILD-TIMESTAMP.TXT b/lib/loggerpro/LOGGERPRO-BUILD-TIMESTAMP.TXT index 29be0ab0..847bdd2a 100644 --- a/lib/loggerpro/LOGGERPRO-BUILD-TIMESTAMP.TXT +++ b/lib/loggerpro/LOGGERPRO-BUILD-TIMESTAMP.TXT @@ -1 +1 @@ -16/06/2019 10:22:14 +14/05/2020 19:08:39 diff --git a/lib/loggerpro/LoggerPro.VCLListBoxAppender.pas b/lib/loggerpro/LoggerPro.VCLListBoxAppender.pas new file mode 100644 index 00000000..79c64431 --- /dev/null +++ b/lib/loggerpro/LoggerPro.VCLListBoxAppender.pas @@ -0,0 +1,91 @@ +unit LoggerPro.VCLListBoxAppender; +{ <@abstract(The unit to include if you want to use the @link(TVCLListBoxAppender)) + @author(David Cornelius) } + +interface + +uses + LoggerPro, + System.Classes, + Vcl.StdCtrls; + +type + { @abstract(Appends formatted @link(TLogItem) to a TListBox in a VCL application) } + TVCLListBoxAppender = class(TLoggerProAppenderBase) + private + FLB: TListBox; + FMaxLogLines: Word; + FLogFormat: string; + public const + { @abstract(Defines the default format string used by the @link(TLoggerProFileAppender).) + The positional parameters are the followings: + @orderedList( + @itemSetNumber 0 + @item TimeStamp + @item ThreadID + @item LogType + @item LogMessage + @item LogTag + ) + } + DEFAULT_LOG_FORMAT = '%0:s [TID %1:-8d][%2:-10s] %3:s [%4:s]'; + constructor Create(aLB: TListBox; aMaxLogLines: Word = 500; aLogFormat: string = DEFAULT_LOG_FORMAT); reintroduce; + procedure Setup; override; + procedure TearDown; override; + procedure WriteLog(const aLogItem: TLogItem); override; + end; + +implementation + +uses + System.SysUtils; + +{ TVCLListBoxAppender } + +constructor TVCLListBoxAppender.Create(aLB: TListBox; aMaxLogLines: Word; aLogFormat: string); +begin + inherited Create; + FLogFormat := aLogFormat; + FLB := aLB; + FMaxLogLines := aMaxLogLines; +end; + +procedure TVCLListBoxAppender.Setup; +begin + TThread.Synchronize(nil, + procedure + begin + FLB.Clear; + end); +end; + +procedure TVCLListBoxAppender.TearDown; +begin + // do nothing +end; + +procedure TVCLListBoxAppender.WriteLog(const aLogItem: TLogItem); +var + lText: string; +begin + lText := Format(FLogFormat, [datetimetostr(aLogItem.TimeStamp), aLogItem.ThreadID, aLogItem.LogTypeAsString, + aLogItem.LogMessage, aLogItem.LogTag]); + TThread.Queue(nil, + procedure + var + Lines: integer; + begin + FLB.Items.BeginUpdate; + try + Lines := FLB.Items.Count; + if Lines > FMaxLogLines then + FLB.Items.Delete(0); + FLB.AddItem(lText, nil); + FLB.ItemIndex := FLB.Items.Count - 1; + finally + FLB.Items.EndUpdate; + end; + end); +end; + +end. diff --git a/lib/loggerpro/VERSION.TXT b/lib/loggerpro/VERSION.TXT index 4a32d226..ad17f26c 100644 --- a/lib/loggerpro/VERSION.TXT +++ b/lib/loggerpro/VERSION.TXT @@ -1,2 +1,2 @@ -VERSION v1.3.2 -BUILD DATETIME 2019-06-16T10:22:14.093838 +VERSION 1_3_3 +BUILD DATETIME 2020-05-14T19:08:39.337540 diff --git a/lib/loggerpro/dodo.py b/lib/loggerpro/dodo.py deleted file mode 100644 index 8ed42e38..00000000 --- a/lib/loggerpro/dodo.py +++ /dev/null @@ -1,125 +0,0 @@ -import subprocess -import os -from datetime import datetime -from colorama import * -init() #colorama initialization - -### task setup env -DOIT_CONFIG = {'verbosity': 2, 'default_tasks': ['build']} - -############################################################################################### -############## CONFIGURATION ################################################################## -############################################################################################### -projects = [ - ('samples\\01_global_logger\\global_logger.dproj','Win32'), - ('samples\\02_file_appender\\file_appender.dproj','Win32'), - ('samples\\03_console_appender\\console_appender.dproj','Win32'), - ('samples\\04_outputdebugstring_appender\\outputdebugstring_appender.dproj','Win32'), - ('samples\\05_vcl_appenders\\vcl_appenders.dproj','Win32'), - ('samples\\08_email_appender\\email_appender.dproj','Win32'), - ('samples\\10_multiple_appenders\\multiple_appenders.dproj','Win32'), - ('samples\\15_appenders_with_different_log_levels\\multi_appenders_different_loglevels.dproj','Win32'), - ('samples\\20_multiple_loggers\\multiple_loggers.dproj','Win32'), - ('samples\\50_custom_appender\\custom_appender.dproj','Win32'), - ('samples\\60_logging_inside_dll\\MainProgram.dproj','Win32'), - ('samples\\60_logging_inside_dll\\mydll.dproj','Win32'), - ('samples\\70_isapi_sample\\loggerproisapisample.dproj','Win32'), - ('samples\\90_remote_logging_with_redis\\REDISAppenderSample.dproj','Win32'), - ('samples\\90_remote_logging_with_redis\\redis_logs_viewer\\REDISLogsViewer.dproj','Win32'), - ('samples\\100_udp_syslog\\udp_syslog.dproj','Win32'), - ('samples\\110_rest_appender\RESTAppenderSample.dproj','Win32'), - ('samples\\110_rest_appender_mobile\RESTAppenderMobileSample.dproj','Android'), - ('samples\\120_elastic_search_appender\\ElasticSearchAppenderSample.dproj','Win32'), - ('samples\\rest_logs_collector\RESTLogsCollector.dproj','Win32') -] - -release_path = "BUILD" -############################################################################################### -############## END CONFIGURATION ############################################################## -############################################################################################### - -GlobalBuildVersion = 'DEV' #if we are building an actual release, this will be replaced - -def header(headers): - elements = None - if type(headers).__name__ == 'str': - elements = [headers] - else: - elements = headers - - print(Style.BRIGHT + Back.WHITE + Fore.RED + "*" * 80 + Style.RESET_ALL) - for txt in elements: - s = '{:^80}'.format(txt) - print(Style.BRIGHT + Back.WHITE + Fore.RED + s + Style.RESET_ALL) - print(Style.BRIGHT + Back.WHITE + Fore.RED + "*" * 80 + Style.RESET_ALL) - - -def buildProject(project, config = 'DEBUG'): - project_file, platform = project - header(["Building", project_file,"(config " + config + ")"]) - p = project_file.replace('.dproj', '.cfg') - if os.path.isfile(p): - if os.path.isfile(p + '.unused'): - os.remove(p + '.unused') - os.rename(p, p + '.unused') - return subprocess.call(f"rsvars.bat & msbuild /t:Build /p:Config={config} /p:Platform={platform} \"{project_file}\"", shell=True) == 0 - -def buildProjects(): - res = True - for project in projects: - res &= buildProject(project) - if not res: - print("Failed " + project[0]) - return res - - -def build_unit_tests(): - res = buildProject(('unittests\\UnitTests.dproj','Win32'), 'PLAINDUNITX') - return res - - -def create_build_tag(version): - global GlobalBuildVersion - GlobalBuildVersion = version - header("BUILD VERSION: " + GlobalBuildVersion) - f = open("VERSION.TXT","w") - f.write("VERSION " + GlobalBuildVersion + "\n") - f.write("BUILD DATETIME " + datetime.now().isoformat() + "\n") - f.close() - -############################################################################################################################# - -def task_build(): - '''Use: doit build -v -> Builds all the projects. Then creates SFX archive.''' - return { - 'actions': [ - create_build_tag, - "echo %%date%% %%time:~0,8%% > LOGGERPRO-BUILD-TIMESTAMP.TXT", - buildProjects, - build_unit_tests, - "unittests\\Win32\\PLAINDUNITX\\UnitTests.exe -exit:Continue"], - 'params':[{'name':'version', - 'short':'v', - 'long':'version', - 'type':str, - 'default':'DEVELOPMENT'} - ], - 'verbosity': 2 - } - -def task_unittests(): - '''Use: doit unittests. Builds unittests project and run it.''' - return { - 'actions': [ - build_unit_tests, - "unittests\\Win32\\PLAINDUNITX\\UnitTests.exe -exit:Continue" - ], - 'params':[{'name':'version', - 'short':'v', - 'long':'version', - 'type':str, - 'default':'DEVELOPMENT'} - ], - 'verbosity': 2 - } - \ No newline at end of file diff --git a/lib/loggerpro/packages/d103/loggerproRT.dproj b/lib/loggerpro/packages/d103/loggerproRT.dproj index e954f13d..7e85e9e5 100644 --- a/lib/loggerpro/packages/d103/loggerproRT.dproj +++ b/lib/loggerpro/packages/d103/loggerproRT.dproj @@ -2,7 +2,7 @@ {1611FBE6-5266-48FE-BDF5-E46EEAA922BE} loggerproRT.dpk - 18.8 + 18.6 None True Debug @@ -18,11 +18,6 @@ Base true - - true - Base - true - true Base @@ -63,15 +58,6 @@ None android-support-v4.dex.jar;cloud-messaging.dex.jar;fmx.dex.jar;google-analytics-v2.dex.jar;google-play-billing.dex.jar;google-play-licensing.dex.jar;google-play-services-ads-7.0.0.dex.jar;google-play-services-analytics-7.0.0.dex.jar;google-play-services-base-7.0.0.dex.jar;google-play-services-gcm-7.0.0.dex.jar;google-play-services-identity-7.0.0.dex.jar;google-play-services-maps-7.0.0.dex.jar;google-play-services-panorama-7.0.0.dex.jar;google-play-services-plus-7.0.0.dex.jar;google-play-services-wallet-7.0.0.dex.jar - - package=com.embarcadero.$(MSBuildProjectName);label=$(MSBuildProjectName);versionCode=1;versionName=1.0.0;persistent=False;restoreAnyVersion=False;installLocation=auto;largeHeap=False;theme=TitleBar;hardwareAccelerated=true;apiKey= - Debug - true - Base - true - None - android-support-v4.dex.jar;cloud-messaging.dex.jar;fmx.dex.jar;google-analytics-v2.dex.jar;google-play-billing.dex.jar;google-play-licensing.dex.jar;google-play-services-ads-7.0.0.dex.jar;google-play-services-analytics-7.0.0.dex.jar;google-play-services-base-7.0.0.dex.jar;google-play-services-gcm-7.0.0.dex.jar;google-play-services-identity-7.0.0.dex.jar;google-play-services-maps-7.0.0.dex.jar;google-play-services-panorama-7.0.0.dex.jar;google-play-services-plus-7.0.0.dex.jar;google-play-services-wallet-7.0.0.dex.jar - Winapi;System.Win;Data.Win;Datasnap.Win;Web.Win;Soap.Win;Xml.Win;Bde;$(DCC_Namespace) Debug @@ -120,7 +106,6 @@ - Cfg_2 Base @@ -194,20 +179,12 @@ classes 1 - - classes - 1 - res\xml 1 - - res\xml - 1 - @@ -220,242 +197,96 @@ library\lib\armeabi 1 - - library\lib\armeabi - 1 - - - - - library\lib\armeabi-v7a - 1 - library\lib\mips 1 - - library\lib\mips - 1 - library\lib\armeabi-v7a 1 - - library\lib\arm64-v8a - 1 - - - - - library\lib\armeabi-v7a - 1 - res\drawable 1 - - res\drawable - 1 - res\values 1 - - res\values - 1 - res\values-v21 1 - - res\values-v21 - 1 - - - - - res\values - 1 - - - res\values - 1 - res\drawable 1 - - res\drawable - 1 - res\drawable-xxhdpi 1 - - res\drawable-xxhdpi - 1 - res\drawable-ldpi 1 - - res\drawable-ldpi - 1 - res\drawable-mdpi 1 - - res\drawable-mdpi - 1 - res\drawable-hdpi 1 - - res\drawable-hdpi - 1 - res\drawable-xhdpi 1 - - res\drawable-xhdpi - 1 - - - - - res\drawable-mdpi - 1 - - - res\drawable-mdpi - 1 - - - - - res\drawable-hdpi - 1 - - - res\drawable-hdpi - 1 - - - - - res\drawable-xhdpi - 1 - - - res\drawable-xhdpi - 1 - - - - - res\drawable-xxhdpi - 1 - - - res\drawable-xxhdpi - 1 - - - - - res\drawable-xxxhdpi - 1 - - - res\drawable-xxxhdpi - 1 - res\drawable-small 1 - - res\drawable-small - 1 - res\drawable-normal 1 - - res\drawable-normal - 1 - res\drawable-large 1 - - res\drawable-large - 1 - res\drawable-xlarge 1 - - res\drawable-xlarge - 1 - - - - - res\values - 1 - - - res\values - 1 - @@ -525,9 +356,6 @@ 0 - - 0 - 0 @@ -558,17 +386,6 @@ 1 - - - 1 - - - 1 - - - 1 - - 1 @@ -580,39 +397,6 @@ 1 - - - 1 - - - 1 - - - 1 - - - - - 1 - - - 1 - - - 1 - - - - - 1 - - - 1 - - - 1 - - 1 @@ -624,61 +408,6 @@ 1 - - - 1 - - - 1 - - - 1 - - - - - 1 - - - 1 - - - 1 - - - - - 1 - - - 1 - - - 1 - - - - - 1 - - - 1 - - - 1 - - - - - 1 - - - 1 - - - 1 - - 1 @@ -690,116 +419,6 @@ 1 - - - 1 - - - 1 - - - 1 - - - - - 1 - - - 1 - - - 1 - - - - - 1 - - - 1 - - - 1 - - - - - 1 - - - 1 - - - 1 - - - - - 1 - - - 1 - - - 1 - - - - - 1 - - - 1 - - - 1 - - - - - 1 - - - 1 - - - 1 - - - - - 1 - - - 1 - - - 1 - - - - - 1 - - - 1 - - - 1 - - - - - 1 - - - 1 - - - 1 - - 1 @@ -833,35 +452,10 @@ 1 - - - 1 - - - 1 - - - 1 - - - - - 1 - - - 1 - - - 1 - - 1 - - 1 - @@ -905,10 +499,6 @@ library\lib\armeabi-v7a 1 - - library\lib\arm64-v8a - 1 - 1 @@ -931,12 +521,6 @@ 0 - - - library\lib\armeabi-v7a - 1 - - 1 @@ -974,11 +558,9 @@ - False - False False True False diff --git a/lib/loggerpro/packages/d104/loggerproRT.dpk b/lib/loggerpro/packages/d104/loggerproRT.dpk new file mode 100644 index 00000000..0ea8350b --- /dev/null +++ b/lib/loggerpro/packages/d104/loggerproRT.dpk @@ -0,0 +1,54 @@ +package loggerproRT; + +{$R *.res} +{$IFDEF IMPLICITBUILDING This IFDEF should not be used by users} +{$ALIGN 8} +{$ASSERTIONS ON} +{$BOOLEVAL OFF} +{$DEBUGINFO OFF} +{$EXTENDEDSYNTAX ON} +{$IMPORTEDDATA ON} +{$IOCHECKS ON} +{$LOCALSYMBOLS ON} +{$LONGSTRINGS ON} +{$OPENSTRINGS ON} +{$OPTIMIZATION OFF} +{$OVERFLOWCHECKS OFF} +{$RANGECHECKS OFF} +{$REFERENCEINFO ON} +{$SAFEDIVIDE OFF} +{$STACKFRAMES ON} +{$TYPEDADDRESS OFF} +{$VARSTRINGCHECKS ON} +{$WRITEABLECONST OFF} +{$MINENUMSIZE 1} +{$IMAGEBASE $400000} +{$DEFINE DEBUG} +{$ENDIF IMPLICITBUILDING} +{$DESCRIPTION 'LoggerPro'} +{$LIBSUFFIX '104'} +{$RUNONLY} +{$IMPLICITBUILD ON} + +requires + rtl, + IndySystem, + IndyProtocols, + IndyCore; + +contains + LoggerPro.ElasticSearchAppender in '..\..\LoggerPro.ElasticSearchAppender.pas', + LoggerPro.EMailAppender in '..\..\LoggerPro.EMailAppender.pas', + LoggerPro.FileAppender in '..\..\LoggerPro.FileAppender.pas', + LoggerPro.GlobalLogger in '..\..\LoggerPro.GlobalLogger.pas', + LoggerPro.MemoryAppender in '..\..\LoggerPro.MemoryAppender.pas', + LoggerPro.NSQAppender in '..\..\LoggerPro.NSQAppender.pas', + LoggerPro in '..\..\LoggerPro.pas', + LoggerPro.Proxy in '..\..\LoggerPro.Proxy.pas', + LoggerPro.RESTAppender in '..\..\LoggerPro.RESTAppender.pas', + LoggerPro.UDPSyslogAppender in '..\..\LoggerPro.UDPSyslogAppender.pas', + LoggerPro.Utils in '..\..\LoggerPro.Utils.pas', + ThreadSafeQueueU in '..\..\ThreadSafeQueueU.pas', + LoggerPro.OutputDebugStringAppender in '..\..\LoggerPro.OutputDebugStringAppender.pas'; + +end. diff --git a/lib/loggerpro/unittests/UnitTests.dproj b/lib/loggerpro/packages/d104/loggerproRT.dproj similarity index 56% rename from lib/loggerpro/unittests/UnitTests.dproj rename to lib/loggerpro/packages/d104/loggerproRT.dproj index 70834994..50e8ace5 100644 --- a/lib/loggerpro/unittests/UnitTests.dproj +++ b/lib/loggerpro/packages/d104/loggerproRT.dproj @@ -1,29 +1,34 @@  - {3FEE058F-0B85-446A-8517-E7B9BCAAC8CA} - 18.6 - UnitTests.dpr + {1611FBE6-5266-48FE-BDF5-E46EEAA922BE} + loggerproRT.dpk + 19.0 + None True - PLAINDUNITX + Debug Win32 1 - Console - VCL + Package true + + true + Base + true + + + true + Base + true + true Base true - - true - Base - true - - + true Base true @@ -34,26 +39,12 @@ true true - + true Base true - - true - Cfg_2 - true - true - - CompanyName=;FileVersion=1.0.0.0;InternalName=;LegalCopyright=;LegalTrademarks=;OriginalFilename=;ProductVersion=1.0.0.0;Comments=;ProgramID=com.embarcadero.$(MSBuildProjectName);FileDescription=$(MSBuildProjectName);ProductName=$(MSBuildProjectName) - 1040 - $(BDS)\bin\delphi_PROJECTICNS.icns - true - $(DUnitX);$(DCC_UnitSearchPath) - System;Xml;Data;Datasnap;Web;Soap;Vcl;Vcl.Imaging;Vcl.Touch;Vcl.Samples;Vcl.Shell;$(DCC_Namespace) - $(BDS)\bin\delphi_PROJECTICON.ico - UnitTests .\$(Platform)\$(Config) .\$(Platform)\$(Config) false @@ -61,18 +52,35 @@ false false false + true + true + System;Xml;Data;Datasnap;Web;Soap;$(DCC_Namespace) + All + loggerproRT + true + + + None + android-support-v4.dex.jar;cloud-messaging.dex.jar;fmx.dex.jar;google-analytics-v2.dex.jar;google-play-billing.dex.jar;google-play-licensing.dex.jar;google-play-services-ads-7.0.0.dex.jar;google-play-services-analytics-7.0.0.dex.jar;google-play-services-base-7.0.0.dex.jar;google-play-services-gcm-7.0.0.dex.jar;google-play-services-identity-7.0.0.dex.jar;google-play-services-maps-7.0.0.dex.jar;google-play-services-panorama-7.0.0.dex.jar;google-play-services-plus-7.0.0.dex.jar;google-play-services-wallet-7.0.0.dex.jar + + + package=com.embarcadero.$(MSBuildProjectName);label=$(MSBuildProjectName);versionCode=1;versionName=1.0.0;persistent=False;restoreAnyVersion=False;installLocation=auto;largeHeap=False;theme=TitleBar;hardwareAccelerated=true;apiKey= + Debug + true + Base + true + None + android-support-v4.dex.jar;cloud-messaging.dex.jar;fmx.dex.jar;google-analytics-v2.dex.jar;google-play-billing.dex.jar;google-play-licensing.dex.jar;google-play-services-ads-7.0.0.dex.jar;google-play-services-analytics-7.0.0.dex.jar;google-play-services-base-7.0.0.dex.jar;google-play-services-gcm-7.0.0.dex.jar;google-play-services-identity-7.0.0.dex.jar;google-play-services-maps-7.0.0.dex.jar;google-play-services-panorama-7.0.0.dex.jar;google-play-services-plus-7.0.0.dex.jar;google-play-services-wallet-7.0.0.dex.jar - (None) - DBXSqliteDriver;DBXDb2Driver;dxCoreRS23;vclactnband;frxe23;vclFireDAC;dxPSLnksRS23;dxPSdxLCLnkRS23;tethering;cxDataRS23;dxPSdxOCLnkRS23;dxTabbedMDIRS23;FireDACADSDriver;dxSkinBlackRS23;dxSkinLondonLiquidSkyRS23;JvPluginSystem;dxDBXServerModeRS23;dxHttpIndyRequestRS23;dxPScxGridLnkRS23;cxSchedulerRS23;FireDACMSSQLDriver;dclRBDBE1723;vcltouch;JvBands;vcldb;rbDB1723;svn;dxWizardControlRS23;dxSkinMcSkinRS23;dxPScxCommonRS23;JvJans;Intraweb;dxSkinOffice2007BlueRS23;rbIBE1723;dxBarRS23;cxSchedulerRibbonStyleEventEditorRS23;dxSkinOffice2013WhiteRS23;JvDotNetCtrls;dxPSTeeChartRS23;cxLibraryRS23;dxSkinVisualStudio2013LightRS23;vclib;cxPivotGridChartRS23;rbDBE1723;dxSkinSummer2008RS23;dxPSdxDBOCLnkRS23;dxGDIPlusRS23;dxSkinDarkSideRS23;FireDACDBXDriver;dxSkinFoggyRS23;dxSkinSevenRS23;vclx;rbCIDE1723;dxSkinOffice2010SilverRS23;dxdborRS23;RESTBackendComponents;dxLayoutControlRS23;dxPSPrVwRibbonRS23;VCLRESTComponents;dxSkinDevExpressStyleRS23;dxSkinWhiteprintRS23;vclie;bindengine;CloudService;rbRAP1723;JvHMI;FireDACMySQLDriver;dxSkinOffice2013DarkGrayRS23;DataSnapClient;dxPScxPCProdRS23;bindcompdbx;DBXSybaseASEDriver;IndyIPServer;dxSkinPumpkinRS23;IndySystem;dsnapcon;cxTreeListdxBarPopupMenuRS23;dclRBIBE1723;FireDACMSAccDriver;fmxFireDAC;FireDACInfxDriver;vclimg;dxSkinLilianRS23;Jcl;rbADO1723;dxBarDBNavRS23;dxFlowChartRS23;dxSkinOffice2016ColorfulRS23;rbUSER1723;DBXOdbcDriver;FireDACTDataDriver;FMXTee;ipstudiowinclient;soaprtl;DbxCommonDriver;dxSpreadSheetRS23;AsyncProDR;JvManagedThreads;dxSkinOffice2007PinkRS23;dxPSdxSpreadSheetLnkRS23;xmlrtl;soapmidas;DataSnapNativeClient;fmxobj;DTKANPRPackage;dxSkinHighContrastRS23;rtl;dxSkinSevenClassicRS23;DbxClientDriver;dxSkinDevExpressDarkStyleRS23;DBXSybaseASADriver;dxNavBarRS23;dxSkinMetropolisDarkRS23;CodeSiteExpressPkg;dxSkinTheAsphaltWorldRS23;JvSystem;SampleListViewMultiDetailAppearancePackage;dxRichEditControlRS23;JvStdCtrls;JvTimeFramework;ipstudiowin;appanalytics;cxPivotGridRS23;rbUSERDesign1723;dxSkinsdxDLPainterRS23;IndyIPClient;dxRibbonRS23;dxPScxVGridLnkRS23;bindcompvcl;frxDB23;vcldbx;dxSkinOffice2007SilverRS23;dxPScxTLLnkRS23;dxMapControlRS23;TeeUI;rbDIDE1723;JvPascalInterpreter;JvDocking;VclSmp;dxPScxSchedulerLnkRS23;cxTreeListRS23;FireDACODBCDriver;JclVcl;DataSnapIndy10ServerTransport;dxRibbonCustomizationFormRS23;dxPSRichEditControlLnkRS23;dxBarExtDBItemsRS23;DataSnapProviderClient;FireDACMongoDBDriver;dxSkiniMaginaryRS23;frx23;dxSpellCheckerRS23;JvControls;dxSkinsdxBarPainterRS23;JvPrintPreview;dxSkinCoffeeRS23;DataSnapServerMidas;RESTComponents;DBXInterBaseDriver;rbRTL1723;dxADOServerModeRS23;emsclientfiredac;DataSnapFireDAC;svnui;dxmdsRS23;dxSkinLiquidSkyRS23;dxdbtrRS23;dxSkinSpringTimeRS23;dxPSDBTeeChartRS23;JvGlobus;dxSkinscxPCPainterRS23;dxPSCoreRS23;DBXMSSQLDriver;JvMM;dxSkinXmas2008BlueRS23;rbDAD1723;DatasnapConnectorsFreePascal;bindcompfmx;JvNet;DBXOracleDriver;dxSkinSilverRS23;dxSkinValentineRS23;inetdb;JvAppFrm;ipstudiowinwordxp;rbTC1723;FmxTeeUI;dxBarExtItemsRS23;FireDACIBDriver;fmx;fmxdae;DelphiCookbookListViewAppearance;dxServerModeRS23;dxPsPrVwAdvRS23;dxSkinOffice2010BlackRS23;JvWizards;cxPageControlRS23;dxSkinStardustRS23;cxSchedulerGridRS23;dbexpress;IndyCore;dxSkinSharpPlusRS23;UIBD21Win32R;JvPageComps;dsnap;DataSnapCommon;emsclient;FireDACCommon;dxSkinOffice2010BlueRS23;bdertl;JvDB;dxSkinVS2010RS23;dxSkinMetropolisRS23;DataSnapConnectors;cxVerticalGridRS23;soapserver;dxSkinCaramelRS23;frxTee23;dxTileControlRS23;JclDeveloperTools;cxGridRS23;CPortLibDXE;FireDACOracleDriver;DBXMySQLDriver;JvCmp;rbFireDAC1723;DBXFirebirdDriver;FireDACCommonDriver;rbTCUI1723;LockBoxDR;inet;IndyIPCommon;JvCustom;dxSkinDarkRoomRS23;dxDockingRS23;vcl;dxSkinOffice2007GreenRS23;dxPScxExtCommonRS23;JvXPCtrls;dxSkinsCoreRS23;FireDACDb2Driver;dxThemeRS23;dxSkinsdxRibbonPainterRS23;dxSkinVisualStudio2013BlueRS23;rbRest1723;TSG5201;dxSkinMoneyTwinsRS23;dxPSdxFCLnkRS23;dxtrmdRS23;TeeDB;FireDAC;cxSchedulerTreeBrowserRS23;JvCore;dxFireDACServerModeRS23;dxSkinBlueRS23;OverbyteIcsD10SRun;JvCrypt;FireDACSqliteDriver;FireDACPgDriver;ibmonitor;FireDACASADriver;cxEditorsRS23;dxSkinGlassOceansRS23;JvDlgs;JvRuntimeDesign;dxSkinsdxNavBarPainterRS23;dxGaugeControlRS23;ibxpress;Tee;dxSkinSharpRS23;DataSnapServer;ibxbindings;cxPivotGridOLAPRS23;rbIDE1723;vclwinx;FireDACDSDriver;dxSkinBlueprintRS23;dxSkinOffice2007BlackRS23;CustomIPTransport;vcldsnap;rbBDE1723;dxSkinOffice2013LightGrayRS23;bindcomp;DBXInformixDriver;officeXPrt;dxPSdxGaugeControlLnkRS23;dxPScxPivotGridLnkRS23;dxorgcRS23;dxPSdxDBTVLnkRS23;dclRBADO1723;vclribbon;dbxcds;KernowSoftwareFMX;adortl;dclRBFireDAC1723;dclRBE1723;dxComnRS23;dsnapxml;dbrtl;inetdbxpress;IndyProtocols;cxExportRS23;dxSkinOffice2016DarkRS23;JclContainers;dxSkinVisualStudio2013DarkRS23;rbRCL1723;dxSkinscxSchedulerPainterRS23;rbRIDE1723;fmxase;$(DCC_UsePackage) Winapi;System.Win;Data.Win;Datasnap.Win;Web.Win;Soap.Win;Xml.Win;Bde;$(DCC_Namespace) + Debug + true + CompanyName=;FileDescription=$(MSBuildProjectName);FileVersion=1.0.0.0;InternalName=;LegalCopyright=;LegalTrademarks=;OriginalFilename=;ProgramID=com.embarcadero.$(MSBuildProjectName);ProductName=$(MSBuildProjectName);ProductVersion=1.0.0.0;Comments= 1033 - - DBXSqliteDriver;DBXDb2Driver;dxCoreRS23;vclactnband;vclFireDAC;dxPSLnksRS23;dxPSdxLCLnkRS23;tethering;cxDataRS23;dxPSdxOCLnkRS23;dxTabbedMDIRS23;FireDACADSDriver;dxSkinBlackRS23;dxSkinLondonLiquidSkyRS23;dxDBXServerModeRS23;dxHttpIndyRequestRS23;dxPScxGridLnkRS23;cxSchedulerRS23;FireDACMSSQLDriver;vcltouch;vcldb;dxWizardControlRS23;dxSkinMcSkinRS23;dxPScxCommonRS23;Intraweb;dxSkinOffice2007BlueRS23;dxBarRS23;cxSchedulerRibbonStyleEventEditorRS23;dxSkinOffice2013WhiteRS23;dxPSTeeChartRS23;cxLibraryRS23;dxSkinVisualStudio2013LightRS23;vclib;cxPivotGridChartRS23;dxSkinSummer2008RS23;dxPSdxDBOCLnkRS23;dxGDIPlusRS23;dxSkinDarkSideRS23;FireDACDBXDriver;dxSkinFoggyRS23;dxSkinSevenRS23;vclx;dxSkinOffice2010SilverRS23;dxdborRS23;RESTBackendComponents;dxLayoutControlRS23;dxPSPrVwRibbonRS23;VCLRESTComponents;dxSkinDevExpressStyleRS23;dxSkinWhiteprintRS23;vclie;bindengine;CloudService;FireDACMySQLDriver;dxSkinOffice2013DarkGrayRS23;DataSnapClient;dxPScxPCProdRS23;bindcompdbx;DBXSybaseASEDriver;IndyIPServer;dxSkinPumpkinRS23;IndySystem;dsnapcon;cxTreeListdxBarPopupMenuRS23;FireDACMSAccDriver;fmxFireDAC;FireDACInfxDriver;vclimg;dxSkinLilianRS23;dxBarDBNavRS23;dxFlowChartRS23;dxSkinOffice2016ColorfulRS23;DBXOdbcDriver;FireDACTDataDriver;FMXTee;ipstudiowinclient;soaprtl;DbxCommonDriver;dxSpreadSheetRS23;AsyncProDR;dxSkinOffice2007PinkRS23;dxPSdxSpreadSheetLnkRS23;xmlrtl;soapmidas;DataSnapNativeClient;fmxobj;dxSkinHighContrastRS23;rtl;dxSkinSevenClassicRS23;DbxClientDriver;dxSkinDevExpressDarkStyleRS23;DBXSybaseASADriver;dxNavBarRS23;dxSkinMetropolisDarkRS23;dxSkinTheAsphaltWorldRS23;dxRichEditControlRS23;ipstudiowin;appanalytics;cxPivotGridRS23;dxSkinsdxDLPainterRS23;IndyIPClient;dxRibbonRS23;dxPScxVGridLnkRS23;bindcompvcl;dxSkinOffice2007SilverRS23;dxPScxTLLnkRS23;dxMapControlRS23;TeeUI;VclSmp;dxPScxSchedulerLnkRS23;cxTreeListRS23;FireDACODBCDriver;DataSnapIndy10ServerTransport;dxRibbonCustomizationFormRS23;dxPSRichEditControlLnkRS23;dxBarExtDBItemsRS23;DataSnapProviderClient;FireDACMongoDBDriver;dxSkiniMaginaryRS23;dxSpellCheckerRS23;dxSkinsdxBarPainterRS23;dxSkinCoffeeRS23;DataSnapServerMidas;RESTComponents;DBXInterBaseDriver;dxADOServerModeRS23;emsclientfiredac;DataSnapFireDAC;dxmdsRS23;dxSkinLiquidSkyRS23;dxdbtrRS23;dxSkinSpringTimeRS23;dxPSDBTeeChartRS23;dxSkinscxPCPainterRS23;dxPSCoreRS23;DBXMSSQLDriver;dxSkinXmas2008BlueRS23;DatasnapConnectorsFreePascal;bindcompfmx;DBXOracleDriver;dxSkinSilverRS23;dxSkinValentineRS23;inetdb;FmxTeeUI;dxBarExtItemsRS23;FireDACIBDriver;fmx;fmxdae;dxServerModeRS23;dxPsPrVwAdvRS23;dxSkinOffice2010BlackRS23;cxPageControlRS23;dxSkinStardustRS23;cxSchedulerGridRS23;dbexpress;IndyCore;dxSkinSharpPlusRS23;dsnap;DataSnapCommon;emsclient;FireDACCommon;dxSkinOffice2010BlueRS23;dxSkinVS2010RS23;dxSkinMetropolisRS23;DataSnapConnectors;cxVerticalGridRS23;soapserver;dxSkinCaramelRS23;dxTileControlRS23;cxGridRS23;FireDACOracleDriver;DBXMySQLDriver;DBXFirebirdDriver;FireDACCommonDriver;LockBoxDR;inet;IndyIPCommon;dxSkinDarkRoomRS23;dxDockingRS23;vcl;dxSkinOffice2007GreenRS23;dxPScxExtCommonRS23;dxSkinsCoreRS23;FireDACDb2Driver;dxThemeRS23;dxSkinsdxRibbonPainterRS23;dxSkinVisualStudio2013BlueRS23;dxSkinMoneyTwinsRS23;dxPSdxFCLnkRS23;dxtrmdRS23;TeeDB;FireDAC;cxSchedulerTreeBrowserRS23;dxFireDACServerModeRS23;dxSkinBlueRS23;OverbyteIcsD10SRun;FireDACSqliteDriver;FireDACPgDriver;ibmonitor;FireDACASADriver;cxEditorsRS23;dxSkinGlassOceansRS23;dxSkinsdxNavBarPainterRS23;dxGaugeControlRS23;ibxpress;Tee;dxSkinSharpRS23;DataSnapServer;ibxbindings;cxPivotGridOLAPRS23;vclwinx;FireDACDSDriver;dxSkinBlueprintRS23;dxSkinOffice2007BlackRS23;CustomIPTransport;vcldsnap;dxSkinOffice2013LightGrayRS23;bindcomp;DBXInformixDriver;officeXPrt;dxPSdxGaugeControlLnkRS23;dxPScxPivotGridLnkRS23;dxorgcRS23;dxPSdxDBTVLnkRS23;vclribbon;dbxcds;adortl;dxComnRS23;dsnapxml;dbrtl;inetdbxpress;IndyProtocols;cxExportRS23;dxSkinOffice2016DarkRS23;dxSkinVisualStudio2013DarkRS23;dxSkinscxSchedulerPainterRS23;fmxase;$(DCC_UsePackage) - - DEBUG;TESTINSIGHT;$(DCC_Define) + DEBUG;$(DCC_Define) true false true @@ -80,66 +88,70 @@ true - 3 - CompanyName=;FileVersion=1.0.0.0;InternalName=;LegalCopyright=;LegalTrademarks=;OriginalFilename=;ProductVersion=1.0.0.0;Comments=;ProgramID=com.embarcadero.$(MSBuildProjectName);FileDescription=$(MSBuildProjectName);ProductName=$(MSBuildProjectName) - ..\;$(DCC_UnitSearchPath) - None - 1033 false + true + 1033 + LoggerPro + 104 - true - true - true - false + false RELEASE;$(DCC_Define) 0 - - - 1033 - (None) - CompanyName=;FileVersion=1.0.0.0;InternalName=;LegalCopyright=;LegalTrademarks=;OriginalFilename=;ProductVersion=1.0.0.0;Comments=;ProgramID=com.embarcadero.$(MSBuildProjectName);FileDescription=$(MSBuildProjectName);ProductName=$(MSBuildProjectName) + 0 MainSource - - - - - - - - - + + + + + + + + + + + + + + + + + + Cfg_2 Base Base - + Cfg_1 Base Delphi.Personality.12 - Console + Package - UnitTests.dpr + loggerproRT.dpk - Embarcadero C++Builder Office 2000 Servers Package - Embarcadero C++Builder Office XP Servers Package - Microsoft Office 2000 Sample Automation Server Wrapper Components - Microsoft Office XP Sample Automation Server Wrapper Components + Microsoft Office 2000 Sample Automation Server Wrapper Components + Microsoft Office XP Sample Automation Server Wrapper Components + + + true + + true @@ -150,14 +162,19 @@ true - + true - + + + true + + + - UnitTests.exe + loggerproRT.bpl true @@ -174,12 +191,20 @@ classes 1 + + classes + 1 + res\xml 1 + + res\xml + 1 + @@ -192,97 +217,242 @@ library\lib\armeabi 1 + + library\lib\armeabi + 1 + + + + + library\lib\armeabi-v7a + 1 + library\lib\mips 1 + + library\lib\mips + 1 + - library\lib\armeabi-v7a 1 + + library\lib\arm64-v8a + 1 + + + + + library\lib\armeabi-v7a + 1 + res\drawable 1 + + res\drawable + 1 + res\values 1 + + res\values + 1 + res\values-v21 1 + + res\values-v21 + 1 + + + + + res\values + 1 + + + res\values + 1 + res\drawable 1 + + res\drawable + 1 + res\drawable-xxhdpi 1 + + res\drawable-xxhdpi + 1 + res\drawable-ldpi 1 + + res\drawable-ldpi + 1 + res\drawable-mdpi 1 + + res\drawable-mdpi + 1 + res\drawable-hdpi 1 + + res\drawable-hdpi + 1 + res\drawable-xhdpi 1 + + res\drawable-xhdpi + 1 + + + + + res\drawable-mdpi + 1 + + + res\drawable-mdpi + 1 + + + + + res\drawable-hdpi + 1 + + + res\drawable-hdpi + 1 + + + + + res\drawable-xhdpi + 1 + + + res\drawable-xhdpi + 1 + + + + + res\drawable-xxhdpi + 1 + + + res\drawable-xxhdpi + 1 + + + + + res\drawable-xxxhdpi + 1 + + + res\drawable-xxxhdpi + 1 + res\drawable-small 1 + + res\drawable-small + 1 + res\drawable-normal 1 + + res\drawable-normal + 1 + res\drawable-large 1 + + res\drawable-large + 1 + res\drawable-xlarge 1 + + res\drawable-xlarge + 1 + + + + + res\values + 1 + + + res\values + 1 + @@ -352,6 +522,9 @@ 0 + + 0 + 0 @@ -404,6 +577,16 @@ 1 + + + ..\$(PROJECTNAME).launchscreen\Assets\LaunchScreenImage.imageset + 1 + + + ..\$(PROJECTNAME).launchscreen\Assets\LaunchScreenImage.imageset + 1 + + 1 @@ -415,6 +598,26 @@ 1 + + + ..\$(PROJECTNAME).launchscreen\Assets\LaunchScreenImage.imageset + 1 + + + ..\$(PROJECTNAME).launchscreen\Assets\LaunchScreenImage.imageset + 1 + + + + + ..\$(PROJECTNAME).launchscreen\Assets\LaunchScreenImage.imageset + 1 + + + ..\$(PROJECTNAME).launchscreen\Assets\LaunchScreenImage.imageset + 1 + + 1 @@ -426,6 +629,16 @@ 1 + + + ..\$(PROJECTNAME).launchscreen\Assets\LaunchScreenImage.imageset + 1 + + + ..\$(PROJECTNAME).launchscreen\Assets\LaunchScreenImage.imageset + 1 + + 1 @@ -448,10 +661,33 @@ 1 + + + ..\$(PROJECTNAME).launchscreen\Assets\LaunchScreenImage.imageset + 1 + + + ..\$(PROJECTNAME).launchscreen\Assets\LaunchScreenImage.imageset + 1 + + + + + ..\$(PROJECTNAME).launchscreen\Assets\LaunchScreenImage.imageset + 1 + + + ..\$(PROJECTNAME).launchscreen\Assets\LaunchScreenImage.imageset + 1 + + 1 + + 1 + @@ -466,6 +702,7 @@ + 1 @@ -495,6 +732,10 @@ library\lib\armeabi-v7a 1 + + library\lib\arm64-v8a + 1 + 1 @@ -517,6 +758,12 @@ 0 + + + library\lib\armeabi-v7a + 1 + + 1 @@ -548,18 +795,21 @@ - + + + False + False + False True False - False 12 diff --git a/lib/loggerpro/unittests/LoggerProTestU.pas b/lib/loggerpro/unittests/LoggerProTestU.pas deleted file mode 100644 index 1b436fe2..00000000 --- a/lib/loggerpro/unittests/LoggerProTestU.pas +++ /dev/null @@ -1,296 +0,0 @@ -unit LoggerProTestU; - -interface - -uses - DUnitX.TestFramework, LoggerPro, LoggerPro.Proxy; - -type - - [TestFixture] - TLoggerProTest = class(TObject) - public - [Setup] - procedure Setup; - [TearDown] - procedure TearDown; - [Test] - procedure TestTLogItemClone; - [Test] - [TestCase('Type DEBUG', '0,DEBUG')] - [TestCase('Type INFO', '1,INFO')] - [TestCase('Type WARN', '2,WARNING')] - [TestCase('Type ERROR', '3,ERROR')] - procedure TestTLogItemTypeAsString(aLogType: Byte; aExpected: String); - - [Test] - procedure TestOnAppenderError; - - [Test] - [TestCase('No proxy', 'false')] - [TestCase('With proxy', 'true')] - procedure TestLogLevel(UseProxy: boolean); - end; - -implementation - -uses - System.SysUtils, TestSupportAppendersU, System.SyncObjs; - -function LogItemAreEquals(A, B: TLogItem): Boolean; -begin - Assert.AreEqual(A.LogType, B.LogType, 'LogType is different'); - Assert.AreEqual(A.LogMessage, B.LogMessage, 'LogMessage is different'); - Assert.AreEqual(A.LogTag, B.LogTag, 'LogTag is different'); - Assert.AreEqual(A.TimeStamp, B.TimeStamp, 'TimeStamp is different'); - Assert.AreEqual(A.ThreadID, B.ThreadID, 'ThreadID is different'); - Result := True; -end; - -procedure TLoggerProTest.Setup; -begin -end; - -procedure TLoggerProTest.TearDown; -begin -end; - -procedure TLoggerProTest.TestLogLevel(UseProxy: boolean); -var - lSetup, lTearDown: TProc; - lTearDownCalled, lSetupCalled: Boolean; - lWriteLog: TProc; - lLogWriter: ILogWriter; - lLogItem: TLogItem; - lEvent: TEvent; - lLock: TObject; - lHistory: TArray; - Appender: ILogAppender; - InvalidItemLogged: int64; -const - STR_FORBIDDEN = 'ignoredmessage'; -begin - lHistory := []; - lLock := TObject.Create; - try - lSetup := procedure - begin - lHistory := lHistory + ['setup']; - lSetupCalled := True; - end; - lTearDown := procedure - begin - lHistory := lHistory + ['teardown']; - lTearDownCalled := True; - end; - lWriteLog := procedure(aLogItem: TLogItem) - begin - lHistory := lHistory + ['writelog' + aLogItem.LogTypeAsString]; - // If the logged message is suppsed to be filtered, increase the "InvalidItemLogged" count - if aLogItem.LogMessage.Equals(STR_FORBIDDEN) then - TInterlocked.Increment(InvalidItemLogged); - TMonitor.Enter(lLock); - try - FreeAndNil(lLogItem); - lLogItem := aLogItem.Clone; - lEvent.SetEvent; - finally - TMonitor.Exit(lLock); - end; - end; - Appender := TMyAppender.Create(lSetup, lTearDown, lWriteLog); - if UseProxy then - begin - Appender := TLoggerProFilter.Build(Appender, - function (LogItem: TLogItem): Boolean - begin - result := not LogItem.LogMessage.Equals(STR_FORBIDDEN); - end - ); - end; - InvalidItemLogged := 0; - lLogWriter := BuildLogWriter([Appender]); - lEvent := TEvent.Create(nil, True, false, ''); - try - // debug message - lEvent.ResetEvent; - InvalidItemLogged := 0; - lLogWriter.Debug('debug message', 'debug'); - if UseProxy then - lLogWriter.Debug('ignoredmessage', 'debug'); - Assert.AreEqual(TWaitResult.wrSignaled, lEvent.WaitFor(5000), - 'Event not released after 5 seconds'); - Assert.AreEqual('debug message', lLogItem.LogMessage); - Assert.AreEqual('debug', lLogItem.LogTag); - Assert.AreEqual('DEBUG', lLogItem.LogTypeAsString); - Assert.AreEqual(Int64(0), Int64(TInterlocked.Read(InvalidItemLogged))); - - // info message - lEvent.ResetEvent; - InvalidItemLogged := 0; - lLogWriter.Info('info message', 'info'); - if UseProxy then - lLogWriter.Info('ignoredmessage', 'info'); - Assert.AreEqual(TWaitResult.wrSignaled, lEvent.WaitFor(5000), - 'Event not released after 5 seconds'); - Assert.AreEqual('info message', lLogItem.LogMessage); - Assert.AreEqual('info', lLogItem.LogTag); - Assert.AreEqual('INFO', lLogItem.LogTypeAsString); - Assert.AreEqual(Int64(0), Int64(TInterlocked.Read(InvalidItemLogged))); - - // warning message - lEvent.ResetEvent; - InvalidItemLogged := 0; - lLogWriter.Warn('warning message', 'warning'); - if UseProxy then - lLogWriter.Warn('ignoredmessage', 'warning'); - Assert.AreEqual(TWaitResult.wrSignaled, lEvent.WaitFor(5000), - 'Event not released after 5 seconds'); - Assert.AreEqual('warning message', lLogItem.LogMessage); - Assert.AreEqual('warning', lLogItem.LogTag); - Assert.AreEqual('WARNING', lLogItem.LogTypeAsString); - Assert.AreEqual(Int64(0), Int64(TInterlocked.Read(InvalidItemLogged))); - - // error message - lEvent.ResetEvent; - InvalidItemLogged := 0; - lLogWriter.Error('error message', 'error'); - if UseProxy then - lLogWriter.Error('ignoredmessage', 'error'); - Assert.AreEqual(TWaitResult.wrSignaled, lEvent.WaitFor(5000), - 'Event not released after 5 seconds'); - Assert.AreEqual('error message', lLogItem.LogMessage); - Assert.AreEqual('error', lLogItem.LogTag); - Assert.AreEqual('ERROR', lLogItem.LogTypeAsString); - Assert.AreEqual(Int64(0), Int64(TInterlocked.Read(InvalidItemLogged))); - - lLogWriter := nil; - Assert.AreEqual(6, Length(lHistory)); - Assert.AreEqual('setup', lHistory[0]); - Assert.AreEqual('writelogDEBUG', lHistory[1]); - Assert.AreEqual('writelogINFO', lHistory[2]); - Assert.AreEqual('writelogWARNING', lHistory[3]); - Assert.AreEqual('writelogERROR', lHistory[4]); - Assert.AreEqual('teardown', lHistory[5]); - finally - lEvent.Free; - end; - finally - lLock.Free; - end; -end; - -procedure TLoggerProTest.TestOnAppenderError; -var - lLog: ILogWriter; - I: Integer; - lEventsHandlers: TLoggerProEventsHandler; - lAppenders: TArray; - lSavedLoggerProAppenderQueueSize: Cardinal; - lOldestsDiscarded: Int64; - lNewestsSkipped: Int64; - lCount: Int64; - lTempCount: Int64; -begin - lCount := 0; - lSavedLoggerProAppenderQueueSize := DefaultLoggerProAppenderQueueSize; - DefaultLoggerProAppenderQueueSize := 0; - - lNewestsSkipped := 0; - lOldestsDiscarded := 0; - lEventsHandlers := TLoggerProEventsHandler.Create; - try - lEventsHandlers.OnAppenderError := - procedure(const AppenderClassName: String; - const FailedLogItem: TLogItem; const Reason: TLogErrorReason; - var Action: TLogErrorAction) - var - lLocalCount: Int64; - begin - lLocalCount := TInterlocked.Add(lCount, 1); - if lLocalCount <= 20 then - begin - Action := TLogErrorAction.SkipNewest; - TInterlocked.Increment(lNewestsSkipped); - end - else - begin - Action := TLogErrorAction.DiscardOlder; - TInterlocked.Increment(lOldestsDiscarded); - end; - end; - - lLog := BuildLogWriter([TMyVerySlowAppender.Create(1)], lEventsHandlers); - for I := 1 to 40 do - begin - lLog.Debug('log message ' + I.ToString, 'tag'); - end; - - while True do - begin - lTempCount := TInterlocked.Read(lNewestsSkipped); - if lTempCount < 20 then - Sleep(10) - else - break; - end; - - while True do - begin - lTempCount := TInterlocked.Read(lOldestsDiscarded); - if lTempCount < 20 then - Sleep(10) - else - break; - end; - - while TInterlocked.Read(lCount) < 40 do - Sleep(100); - - lAppenders := lLog.GetAppendersClassNames; - Assert.AreEqual(1, Length(lAppenders)); - Assert.AreEqual('TMyVerySlowAppender', lAppenders[0]); - lLog := nil; - finally - DefaultLoggerProAppenderQueueSize := lSavedLoggerProAppenderQueueSize; - lEventsHandlers.Free; - end; - -end; - -procedure TLoggerProTest.TestTLogItemClone; -var - lLogItem: TLogItem; - lClonedLogItem: TLogItem; -begin - lLogItem := TLogItem.Create(TLogType.Debug, 'message', 'tag'); - try - lClonedLogItem := lLogItem.Clone; - try - LogItemAreEquals(lLogItem, lClonedLogItem); - finally - lClonedLogItem.Free; - end; - finally - lLogItem.Free; - end; -end; - -procedure TLoggerProTest.TestTLogItemTypeAsString(aLogType: Byte; - aExpected: String); -var - lLogItem: TLogItem; -begin - lLogItem := TLogItem.Create(TLogType(aLogType), 'message', 'tag'); - try - Assert.AreEqual(aExpected, lLogItem.LogTypeAsString); - finally - lLogItem.Free; - end; -end; - -initialization - -TDUnitX.RegisterTestFixture(TLoggerProTest); - -end. diff --git a/lib/loggerpro/unittests/TestSupportAppendersU.pas b/lib/loggerpro/unittests/TestSupportAppendersU.pas deleted file mode 100644 index 895cad26..00000000 --- a/lib/loggerpro/unittests/TestSupportAppendersU.pas +++ /dev/null @@ -1,82 +0,0 @@ -unit TestSupportAppendersU; - -interface - -uses - LoggerPro, System.SysUtils; - -type - TMyAppender = class(TLoggerProAppenderBase) - private - FSetupCallback: TProc; - FTearDownCallback: TProc; - FWriteLogCallback: TProc; - public - constructor Create(aSetupCallback, aTearDownCallback: TProc; - aWriteLogCallback: TProc); reintroduce; - procedure Setup; override; - procedure TearDown; override; - procedure WriteLog(const aLogItem: TLogItem); override; - end; - - TMyVerySlowAppender = class(TLoggerProAppenderBase) - private - FDelay: Cardinal; - public - constructor Create(const aDelay: Cardinal); reintroduce; - procedure Setup; override; - procedure TearDown; override; - procedure WriteLog(const aLogItem: TLogItem); override; - end; - -implementation - -{ TMyAppender } - -constructor TMyAppender.Create(aSetupCallback, aTearDownCallback: TProc; - aWriteLogCallback: TProc); -begin - inherited Create; - FSetupCallback := aSetupCallback; - FTearDownCallback := aTearDownCallback; - FWriteLogCallback := aWriteLogCallback; -end; - -procedure TMyAppender.Setup; -begin - FSetupCallback(); -end; - -procedure TMyAppender.TearDown; -begin - FTearDownCallback(); -end; - -procedure TMyAppender.WriteLog(const aLogItem: TLogItem); -begin - FWriteLogCallback(aLogItem); -end; - -{ TMyVerySlowAppender } - -constructor TMyVerySlowAppender.Create(const aDelay: Cardinal); -begin - FDelay := aDelay; -end; - -procedure TMyVerySlowAppender.Setup; -begin - -end; - -procedure TMyVerySlowAppender.TearDown; -begin - -end; - -procedure TMyVerySlowAppender.WriteLog(const aLogItem: TLogItem); -begin -// Sleep(FDelay); -end; - -end. diff --git a/lib/loggerpro/unittests/UnitTests.dpr b/lib/loggerpro/unittests/UnitTests.dpr deleted file mode 100644 index b0f8e684..00000000 --- a/lib/loggerpro/unittests/UnitTests.dpr +++ /dev/null @@ -1,66 +0,0 @@ -program UnitTests; - -{$IFNDEF TESTINSIGHT} -{$APPTYPE CONSOLE} -{$ENDIF}{$STRONGLINKTYPES ON} -uses - SysUtils, - {$IFDEF TESTINSIGHT} - TestInsight.DUnitX, - {$ENDIF } - DUnitX.Loggers.Console, - DUnitX.Loggers.Xml.NUnit, - DUnitX.TestFramework, - LoggerProTestU in 'LoggerProTestU.pas', - LoggerPro.ConsoleAppender in '..\LoggerPro.ConsoleAppender.pas', - LoggerPro.FileAppender in '..\LoggerPro.FileAppender.pas', - LoggerPro.OutputDebugStringAppender in '..\LoggerPro.OutputDebugStringAppender.pas', - LoggerPro in '..\LoggerPro.pas', - LoggerPro.VCLMemoAppender in '..\LoggerPro.VCLMemoAppender.pas', - TestSupportAppendersU in 'TestSupportAppendersU.pas', - LoggerPro.GlobalLogger in '..\LoggerPro.GlobalLogger.pas'; - -var - runner : ITestRunner; - results : IRunResults; - logger : ITestLogger; - nunitLogger : ITestLogger; -begin -{$IFDEF TESTINSIGHT} - TestInsight.DUnitX.RunRegisteredTests; - exit; -{$ENDIF} - try - //Check command line options, will exit if invalid - TDUnitX.CheckCommandLine; - //Create the test runner - runner := TDUnitX.CreateRunner; - //Tell the runner to use RTTI to find Fixtures - runner.UseRTTI := True; - //tell the runner how we will log things - //Log to the console window - logger := TDUnitXConsoleLogger.Create(true); - runner.AddLogger(logger); - //Generate an NUnit compatible XML File - nunitLogger := TDUnitXXMLNUnitFileLogger.Create(TDUnitX.Options.XMLOutputFile); - runner.AddLogger(nunitLogger); - runner.FailsOnNoAsserts := False; //When true, Assertions must be made during tests; - - //Run tests - results := runner.Execute; - if not results.AllPassed then - System.ExitCode := EXIT_ERRORS; - - {$IFNDEF CI} - //We don't want this happening when running under CI. - if TDUnitX.Options.ExitBehavior = TDUnitXExitBehavior.Pause then - begin - System.Write('Done.. press key to quit.'); - System.Readln; - end; - {$ENDIF} - except - on E: Exception do - System.Writeln(E.ClassName, ': ', E.Message); - end; -end. diff --git a/unittests/general/Several/bin/sqlitetest.db b/unittests/general/Several/bin/sqlitetest.db deleted file mode 100644 index cb26e000..00000000 Binary files a/unittests/general/Several/bin/sqlitetest.db and /dev/null differ