Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Sign in
Toggle navigation
ProjectsStatusManagement
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
hasan.bahjat
ProjectsStatusManagement
Commits
eee081ba
Commit
eee081ba
authored
Aug 31, 2024
by
hasan khaddour
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
configure serilog
parent
3a3ec9b2
Changes
6
Show whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
38 additions
and
2 deletions
+38
-2
PSManagement.Api.csproj
PSManagement.Api/PSManagement.Api.csproj
+6
-0
Program.cs
PSManagement.Api/Program.cs
+7
-0
appsettings.json
PSManagement.Api/appsettings.json
+22
-1
LoggingBehavior.cs
....Application/Behaviors/LoggingBehavior/LoggingBehavior.cs
+1
-0
GetCustomerQuery.cs
...mers/UseCases/Queries/GetCustomerById/GetCustomerQuery.cs
+1
-1
PSManagement.Application.csproj
PSManagement.Application/PSManagement.Application.csproj
+1
-0
No files found.
PSManagement.Api/PSManagement.Api.csproj
View file @
eee081ba
...
@@ -13,7 +13,13 @@
...
@@ -13,7 +13,13 @@
<PrivateAssets>all</PrivateAssets>
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
</PackageReference>
<PackageReference Include="Serilog.AspNetCore" Version="5.0.0" />
<PackageReference Include="Serilog.Extensions.Hosting" Version="4.2.0" />
<PackageReference Include="Swashbuckle.AspNetCore" Version="5.6.3" />
<PackageReference Include="Swashbuckle.AspNetCore" Version="5.6.3" />
<PackageReference Include="Serilog" Version="2.12.0" />
<PackageReference Include="Serilog.Extensions.Logging" Version="3.1.0" />
<PackageReference Include="Serilog.Sinks.File" Version="5.0.0" />
</ItemGroup>
</ItemGroup>
<ItemGroup>
<ItemGroup>
...
...
PSManagement.Api/Program.cs
View file @
eee081ba
...
@@ -6,6 +6,7 @@ using System;
...
@@ -6,6 +6,7 @@ using System;
using
System.Collections.Generic
;
using
System.Collections.Generic
;
using
System.Linq
;
using
System.Linq
;
using
System.Threading.Tasks
;
using
System.Threading.Tasks
;
using
Serilog
;
namespace
PSManagement.Api
namespace
PSManagement.Api
{
{
...
@@ -13,11 +14,17 @@ namespace PSManagement.Api
...
@@ -13,11 +14,17 @@ namespace PSManagement.Api
{
{
public
static
void
Main
(
string
[]
args
)
public
static
void
Main
(
string
[]
args
)
{
{
Log
.
Logger
=
new
LoggerConfiguration
()
.
MinimumLevel
.
Information
()
.
WriteTo
.
File
(
"logs/log-.txt"
,
rollingInterval
:
RollingInterval
.
Day
)
.
CreateLogger
();
CreateHostBuilder
(
args
).
Build
().
Run
();
CreateHostBuilder
(
args
).
Build
().
Run
();
}
}
public
static
IHostBuilder
CreateHostBuilder
(
string
[]
args
)
=>
public
static
IHostBuilder
CreateHostBuilder
(
string
[]
args
)
=>
Host
.
CreateDefaultBuilder
(
args
)
Host
.
CreateDefaultBuilder
(
args
)
.
UseSerilog
()
.
ConfigureWebHostDefaults
(
webBuilder
=>
.
ConfigureWebHostDefaults
(
webBuilder
=>
{
{
webBuilder
.
UseStartup
<
Startup
>();
webBuilder
.
UseStartup
<
Startup
>();
...
...
PSManagement.Api/appsettings.json
View file @
eee081ba
...
@@ -13,6 +13,27 @@
...
@@ -13,6 +13,27 @@
"Issuer"
:
"HIAST-PS-Management-Server"
,
"Issuer"
:
"HIAST-PS-Management-Server"
,
"Audience"
:
"All"
"Audience"
:
"All"
},
},
"Serilog"
:
{
"MinimumLevel"
:
{
"Default"
:
"Information"
,
"Override"
:
{
"Microsoft"
:
"Warning"
,
"System"
:
"Warning"
}
},
"WriteTo"
:
[
{
"Name"
:
"File"
,
"Args"
:
{
"path"
:
"Logs/log-.txt"
,
"rollingInterval"
:
"Day"
}
}
]
},
"ConnectionStrings"
:
{
"ConnectionStrings"
:
{
"DefaultConnection"
:
"Data Source=.
\\
sqlexpress;Initial Catalog=PSManagement ;Integrated Security=True"
"DefaultConnection"
:
"Data Source=.
\\
sqlexpress;Initial Catalog=PSManagement ;Integrated Security=True"
},
},
...
@@ -20,6 +41,6 @@
...
@@ -20,6 +41,6 @@
"SyncIntervalInMinutes"
:
60
"SyncIntervalInMinutes"
:
60
},
},
"FileServiceSettings"
:
{
"FileServiceSettings"
:
{
"AvailableExtension"
:
[
".png"
,
".pdf"
]
"AvailableExtension"
:
[
".png"
,
".pdf"
]
}
}
}
}
PSManagement.Application/Behaviors/LoggingBehavior/LoggingBehavior.cs
View file @
eee081ba
...
@@ -7,6 +7,7 @@ using MediatR;
...
@@ -7,6 +7,7 @@ using MediatR;
using
Microsoft.Extensions.Logging
;
using
Microsoft.Extensions.Logging
;
using
System.Threading
;
using
System.Threading
;
using
PSManagement.SharedKernel.CQRS.Command
;
using
PSManagement.SharedKernel.CQRS.Command
;
using
PSManagement.SharedKernel.CQRS.Query
;
namespace
PSManagement.Application.Behaviors.LoggingBehavior
namespace
PSManagement.Application.Behaviors.LoggingBehavior
{
{
...
...
PSManagement.Application/Customers/UseCases/Queries/GetCustomerById/GetCustomerQuery.cs
View file @
eee081ba
...
@@ -7,6 +7,6 @@ using System.Text;
...
@@ -7,6 +7,6 @@ using System.Text;
namespace
PSManagement.Application.Customers.UseCases.Queries.GetCustomer
namespace
PSManagement.Application.Customers.UseCases.Queries.GetCustomer
{
{
public
record
GetCustomerQuery
(
int
CustomerId
)
:
IQuery
<
Result
<
CustomerDTO
>>;
public
record
GetCustomerQuery
(
int
CustomerId
)
:
I
Loggable
Query
<
Result
<
CustomerDTO
>>;
}
}
PSManagement.Application/PSManagement.Application.csproj
View file @
eee081ba
...
@@ -17,6 +17,7 @@
...
@@ -17,6 +17,7 @@
<PackageReference Include="Microsoft.Extensions.Configuration" Version="5.0.0" />
<PackageReference Include="Microsoft.Extensions.Configuration" Version="5.0.0" />
<PackageReference Include="Microsoft.Extensions.DependencyInjection" Version="5.0.2" />
<PackageReference Include="Microsoft.Extensions.DependencyInjection" Version="5.0.2" />
<PackageReference Include="Microsoft.Extensions.Logging" Version="5.0.0" />
<PackageReference Include="Microsoft.Extensions.Logging" Version="5.0.0" />
</ItemGroup>
</ItemGroup>
<ItemGroup>
<ItemGroup>
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment