Skip to content

Commit

Permalink
Merge pull request #38 from adrianosantostreina/Linux
Browse files Browse the repository at this point in the history
Implementado syslog com Linux.
  • Loading branch information
adrianosantostreina authored Sep 22, 2024
2 parents e36d3ae + 7c514ae commit f220e1b
Show file tree
Hide file tree
Showing 28 changed files with 278 additions and 2,014 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -72,3 +72,4 @@ Samples/# Default Sample/iOSDevice64/Debug/DefaultSample.dSYM
Samples/# Default Sample/iOSSimARM64/Debug/DefaultSample.dSYM
Samples/# Default Sample/iOSDevice64/Debug/DefaultSample
Samples/# Default Sample/iOSSimARM64/Debug/DefaultSample
Samples/Linux/horse/bin/HorseLinux_MultiLog4D
18 changes: 15 additions & 3 deletions MultiLog4D.groupproj
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,9 @@
<Projects Include="Samples\VCL\service\Service_MultiLog4D.dproj">
<Dependencies/>
</Projects>
<Projects Include="Samples\Linux\horse\HorseLinux_MultiLog4D.dproj">
<Dependencies/>
</Projects>
</ItemGroup>
<ProjectExtensions>
<Borland.Personality>Default.Personality.12</Borland.Personality>
Expand Down Expand Up @@ -95,14 +98,23 @@
<Target Name="Service_MultiLog4D:Make">
<MSBuild Projects="Samples\VCL\service\Service_MultiLog4D.dproj" Targets="Make"/>
</Target>
<Target Name="HorseLinux_MultiLog4D">
<MSBuild Projects="Samples\Linux\horse\HorseLinux_MultiLog4D.dproj"/>
</Target>
<Target Name="HorseLinux_MultiLog4D:Clean">
<MSBuild Projects="Samples\Linux\horse\HorseLinux_MultiLog4D.dproj" Targets="Clean"/>
</Target>
<Target Name="HorseLinux_MultiLog4D:Make">
<MSBuild Projects="Samples\Linux\horse\HorseLinux_MultiLog4D.dproj" Targets="Make"/>
</Target>
<Target Name="Build">
<CallTarget Targets="DefaultSample;Android_MultiLog4D;iOS_MultiLog4D;Horse_MultiLog4D;Console_MultiLog4D;VCL_MultiLog4D;Service_MultiLog4D"/>
<CallTarget Targets="DefaultSample;Android_MultiLog4D;iOS_MultiLog4D;Horse_MultiLog4D;Console_MultiLog4D;VCL_MultiLog4D;Service_MultiLog4D;HorseLinux_MultiLog4D"/>
</Target>
<Target Name="Clean">
<CallTarget Targets="DefaultSample:Clean;Android_MultiLog4D:Clean;iOS_MultiLog4D:Clean;Horse_MultiLog4D:Clean;Console_MultiLog4D:Clean;VCL_MultiLog4D:Clean;Service_MultiLog4D:Clean"/>
<CallTarget Targets="DefaultSample:Clean;Android_MultiLog4D:Clean;iOS_MultiLog4D:Clean;Horse_MultiLog4D:Clean;Console_MultiLog4D:Clean;VCL_MultiLog4D:Clean;Service_MultiLog4D:Clean;HorseLinux_MultiLog4D:Clean"/>
</Target>
<Target Name="Make">
<CallTarget Targets="DefaultSample:Make;Android_MultiLog4D:Make;iOS_MultiLog4D:Make;Horse_MultiLog4D:Make;Console_MultiLog4D:Make;VCL_MultiLog4D:Make;Service_MultiLog4D:Make"/>
<CallTarget Targets="DefaultSample:Make;Android_MultiLog4D:Make;iOS_MultiLog4D:Make;Horse_MultiLog4D:Make;Console_MultiLog4D:Make;VCL_MultiLog4D:Make;Service_MultiLog4D:Make;HorseLinux_MultiLog4D:Make"/>
</Target>
<Import Project="$(BDS)\Bin\CodeGear.Group.Targets" Condition="Exists('$(BDS)\Bin\CodeGear.Group.Targets')"/>
</Project>
2 changes: 1 addition & 1 deletion Samples/# Default Sample/DefaultSample.dpr
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ begin
TMultiLog4DUtil
.Logger
.Tag('MultiLog4D')
{$IF DEFINED(ML4D_DESKTOP) OR DEFINED(ML4D_CONSOLE) OR DEFINED(ML4D_SERVICE)}
{$IF DEFINED(ML4D_DESKTOP) OR DEFINED(ML4D_CONSOLE) OR DEFINED(ML4D_EVENTVIEWER)}
.Output(loBoth)
.FileName(TPath.Combine(ExtractFilePath(ParamStr(0)), 'log\MeuLog.log'))
{$ENDIF}
Expand Down
54 changes: 54 additions & 0 deletions Samples/Linux/horse/HorseLinux_MultiLog4D.deployproj
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Condition="Exists('$(BDS)\bin\CodeGear.Deployment.targets')" Project="$(BDS)\bin\CodeGear.Deployment.targets"/>
<ProjectExtensions>
<ProjectFileVersion>12</ProjectFileVersion>
</ProjectExtensions>
<PropertyGroup>
<DeviceId Condition="'$(Platform)'=='Android'"/>
<DeviceId Condition="'$(Platform)'=='Android64'"/>
<DeviceId Condition="'$(Platform)'=='iOSDevice64'"/>
<DeviceId Condition="'$(Platform)'=='iOSSimARM64'"/>
</PropertyGroup>
<ItemGroup Condition="'$(Platform)'=='OSX64'"/>
<ItemGroup Condition="'$(Platform)'=='Win32'">
<DeployFile Include="bin\HorseLinux_MultiLog4D.exe" Condition="'$(Config)'=='Debug'">
<RemoteDir>HorseLinux_MultiLog4D\</RemoteDir>
<RemoteName>HorseLinux_MultiLog4D.exe</RemoteName>
<DeployClass>ProjectOutput</DeployClass>
<Operation>0</Operation>
<LocalCommand/>
<RemoteCommand/>
<Overwrite>True</Overwrite>
<Required>True</Required>
</DeployFile>
</ItemGroup>
<ItemGroup Condition="'$(Platform)'=='Android64'"/>
<ItemGroup Condition="'$(Platform)'=='Android'"/>
<ItemGroup Condition="'$(Platform)'=='OSXARM64'"/>
<ItemGroup Condition="'$(Platform)'=='Win64'"/>
<ItemGroup Condition="'$(Platform)'=='iOSDevice64'"/>
<ItemGroup Condition="'$(Platform)'=='iOSSimARM64'"/>
<ItemGroup Condition="'$(Platform)'=='Win64x'"/>
<ItemGroup Condition="'$(Platform)'=='Linux64'">
<DeployFile Include="bin\HorseLinux_MultiLog4D" Condition="'$(Config)'=='Release'">
<RemoteDir>HorseLinux_MultiLog4D\</RemoteDir>
<RemoteName>HorseLinux_MultiLog4D</RemoteName>
<DeployClass>ProjectOutput</DeployClass>
<Operation>1</Operation>
<LocalCommand/>
<RemoteCommand/>
<Overwrite>True</Overwrite>
<Required>True</Required>
</DeployFile>
<DeployFile Include="bin\HorseLinux_MultiLog4D" Condition="'$(Config)'=='Debug'">
<RemoteDir>HorseLinux_MultiLog4D\</RemoteDir>
<RemoteName>HorseLinux_MultiLog4D</RemoteName>
<DeployClass>ProjectOutput</DeployClass>
<Operation>1</Operation>
<LocalCommand/>
<RemoteCommand/>
<Overwrite>True</Overwrite>
<Required>True</Required>
</DeployFile>
</ItemGroup>
</Project>
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
program Horse_MultiLog4D;
program HorseLinux_MultiLog4D;

{$APPTYPE CONSOLE}

{$R *.res}


uses
Horse,
MultiLog4D.Common,
Expand All @@ -15,59 +16,49 @@ uses
begin
TMultiLog4DUtil
.Logger
.Tag('MultiLog4D')
.Output(loConsole)
.LogWriteInformation('>>>>>>>>>> Starting <<<<<<<<<<');
.LogWriteInformation('Start Application');

THorse
.Get('/test1',
procedure(Req: THorseRequest; Res: THorseResponse)
begin
Randomize;

TMultiLog4DUtil
.Logger
.Output(loConsole)
.LogWriteInformation('Before Test1');
.LogWriteInformation('Before Test1 - ' + Format('Mensagem de teste 1 de log: %d', [Random(1000)]));

Res.Send('test1');

TMultiLog4DUtil
.Logger
.Output(loConsole)
.LogWriteInformation('After Test1');
.LogWriteInformation('After Test1 - ' + Format('Mensagem de teste 1 de log: %d', [Random(1000)]));
end
)
.Get('/test2',
procedure(Req: THorseRequest; Res: THorseResponse)
begin
Randomize;
Res.Send('test2');

TMultiLog4DUtil
.Logger
.Output(loFile)
.Category(TEventCategory.ecSecurity)
.LogWriteInformation('Test2');
.LogWriteInformation(Format('Mensagem de teste 2 de log: %d', [Random(1000)]));
end
)
.Get('/test3',
procedure(Req: THorseRequest; Res: THorseResponse)
var
LOutputLogPath : string;
begin
Randomize;
Res.Send('test3');

LOutputLogPath := TPath.Combine(ExtractFilePath(ParamStr(0)), 'MyLog');
ForceDirectories(LOutputLogPath);

TMultiLog4DUtil
.Logger
.Category(TEventCategory.ecSecurity)
.EventID(123)
.Output(loBoth)
.FileName(TPath.Combine(LOutputLogPath, 'Log.txt'))
.LogWriteInformation('Test3');
.LogWriteInformation(Format('Mensagem de teste 3 de log: %d', [Random(1000)]));
end
);

THorse
.Listen(9000);

end.
Original file line number Diff line number Diff line change
@@ -1,15 +1,14 @@
<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<ProjectGuid>{EF4844CC-8021-4626-BB20-6CD4E16517C4}</ProjectGuid>
<ProjectGuid>{A99B1AF2-F41B-4F7E-9AC3-5000BF8185A1}</ProjectGuid>
<ProjectVersion>20.1</ProjectVersion>
<FrameworkType>None</FrameworkType>
<Base>True</Base>
<Config Condition="'$(Config)'==''">Debug</Config>
<Platform Condition="'$(Platform)'==''">Win32</Platform>
<TargetedPlatforms>131</TargetedPlatforms>
<Platform Condition="'$(Platform)'==''">Linux64</Platform>
<TargetedPlatforms>128</TargetedPlatforms>
<AppType>Console</AppType>
<MainSource>Horse_MultiLog4D.dpr</MainSource>
<ProjectName Condition="'$(ProjectName)'==''">Horse_MultiLog4D</ProjectName>
<MainSource>HorseLinux_MultiLog4D.dpr</MainSource>
</PropertyGroup>
<PropertyGroup Condition="'$(Config)'=='Base' or '$(Base)'!=''">
<Base>true</Base>
Expand Down Expand Up @@ -114,7 +113,7 @@
<DCC_F>false</DCC_F>
<DCC_K>false</DCC_K>
<DCC_Namespace>System;Xml;Data;Datasnap;Web;Soap;$(DCC_Namespace)</DCC_Namespace>
<SanitizedProjectName>Horse_MultiLog4D</SanitizedProjectName>
<SanitizedProjectName>HorseLinux_MultiLog4D</SanitizedProjectName>
<DCC_UnitSearchPath>modules\.dcp;modules\.dcu;modules;modules\horse\src;$(DCC_UnitSearchPath)</DCC_UnitSearchPath>
</PropertyGroup>
<PropertyGroup Condition="'$(Base_Android)'!=''">
Expand Down Expand Up @@ -233,7 +232,10 @@
<Debugger_Launcher>/usr/bin/gnome-terminal -- &quot;%debuggee%&quot;</Debugger_Launcher>
<Manifest_File>(None)</Manifest_File>
<AppDPIAwarenessMode>none</AppDPIAwarenessMode>
<DCC_Define>ML4D_CONSOLE;$(DCC_Define)</DCC_Define>
<DCC_Define>ML4D_CONSOLE;HORSE_DAEMON;$(DCC_Define)</DCC_Define>
<DCC_ExeOutput>.\bin</DCC_ExeOutput>
<DCC_DcuOutput>.\dcu</DCC_DcuOutput>
<Debugger_RunParams>-cleaninstall -debugport=54321</Debugger_RunParams>
</PropertyGroup>
<PropertyGroup Condition="'$(Cfg_1_Win32)'!=''">
<DCC_RemoteDebug>false</DCC_RemoteDebug>
Expand All @@ -258,10 +260,12 @@
</PropertyGroup>
<PropertyGroup Condition="'$(Cfg_2_Linux64)'!=''">
<DCC_UnitSearchPath>..\..\..\src;$(DCC_UnitSearchPath)</DCC_UnitSearchPath>
<DCC_Define>ML4D_CONSOLE;$(DCC_Define)</DCC_Define>
<DCC_Define>ML4D_CONSOLE;HORSE_DAEMON;$(DCC_Define)</DCC_Define>
<Debugger_Launcher>/usr/bin/gnome-terminal -- &quot;%debuggee%&quot;</Debugger_Launcher>
<Manifest_File>(None)</Manifest_File>
<AppDPIAwarenessMode>none</AppDPIAwarenessMode>
<DCC_ExeOutput>.\bin</DCC_ExeOutput>
<DCC_DcuOutput>.\dcu</DCC_DcuOutput>
</PropertyGroup>
<PropertyGroup Condition="'$(Cfg_2_Win32)'!=''">
<DCC_Define>ML4D_CONSOLE;$(DCC_Define)</DCC_Define>
Expand Down Expand Up @@ -299,7 +303,7 @@
<BorlandProject>
<Delphi.Personality>
<Source>
<Source Name="MainSource">Horse_MultiLog4D.dpr</Source>
<Source Name="MainSource">HorseLinux_MultiLog4D.dpr</Source>
</Source>
<Excluded_Packages>
<Excluded_Packages Name="$(BDSBIN)\dcloffice2k290.bpl">Microsoft Office 2000 Sample Automation Server Wrapper Components</Excluded_Packages>
Expand All @@ -322,15 +326,21 @@
<Overwrite>true</Overwrite>
</Platform>
</DeployFile>
<DeployFile LocalName="Linux64\Debug\Horse_MultiLog4D" Configuration="Debug" Class="ProjectOutput">
<DeployFile LocalName="bin\HorseLinux_MultiLog4D.exe" Configuration="Debug" Class="ProjectOutput">
<Platform Name="Win32">
<RemoteName>HorseLinux_MultiLog4D.exe</RemoteName>
<Overwrite>true</Overwrite>
</Platform>
</DeployFile>
<DeployFile LocalName="bin\HorseLinux_MultiLog4D" Configuration="Debug" Class="ProjectOutput">
<Platform Name="Linux64">
<RemoteName>Horse_MultiLog4D</RemoteName>
<RemoteName>HorseLinux_MultiLog4D</RemoteName>
<Overwrite>true</Overwrite>
</Platform>
</DeployFile>
<DeployFile LocalName="Win32\Debug\Horse_MultiLog4D.exe" Configuration="Debug" Class="ProjectOutput">
<Platform Name="Win32">
<RemoteName>Horse_MultiLog4D.exe</RemoteName>
<DeployFile LocalName="bin\HorseLinux_MultiLog4D" Configuration="Release" Class="ProjectOutput">
<Platform Name="Linux64">
<RemoteName>HorseLinux_MultiLog4D</RemoteName>
<Overwrite>true</Overwrite>
</Platform>
</DeployFile>
Expand Down Expand Up @@ -1293,8 +1303,8 @@
<Platform value="Linux64">True</Platform>
<Platform value="OSX64">False</Platform>
<Platform value="OSXARM64">False</Platform>
<Platform value="Win32">True</Platform>
<Platform value="Win64">True</Platform>
<Platform value="Win32">False</Platform>
<Platform value="Win64">False</Platform>
</Platforms>
</BorlandProject>
<ProjectFileVersion>12</ProjectFileVersion>
Expand Down
Binary file added Samples/Linux/horse/HorseLinux_MultiLog4D.res
Binary file not shown.
Binary file removed Samples/Linux/horse/Horse_MultiLog4D.res
Binary file not shown.
47 changes: 0 additions & 47 deletions Samples/Linux/horse/srv_horse.dpr

This file was deleted.

Loading

0 comments on commit f220e1b

Please sign in to comment.