Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

log to stackify if we have a stackify API Key #405

Merged
merged 2 commits into from
Jan 19, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions Sloth.Api/Logging/LoggingConfiguration.cs
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,12 @@ public static LoggerConfiguration GetConfiguration()
logConfig = logConfig
.WriteTo.Console();

// add in stackify sink if the api key is valid
if (!string.IsNullOrEmpty(loggingSection.GetValue<string>("ApiKey")))
{
logConfig = logConfig.WriteTo.Stackify();
}

// add in elastic search sink if the uri is valid
if (Uri.TryCreate(loggingSection.GetValue<string>("ElasticUrl"), UriKind.Absolute, out var elasticUri))
{
Expand Down
1 change: 1 addition & 0 deletions Sloth.Api/Sloth.Api.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@
<PackageReference Include="Serilog.Sinks.Console" Version="4.0.1" />
<PackageReference Include="Serilog.Sinks.Elasticsearch" Version="8.4.1" />
<PackageReference Include="Serilog.Sinks.MSSqlServer" Version="5.7.1" />
<PackageReference Include="Serilog.Sinks.Stackify" Version="2.0.2" />
<PackageReference Include="Swashbuckle.AspNetCore" Version="6.3.1" />
</ItemGroup>

Expand Down
6 changes: 6 additions & 0 deletions Sloth.Jobs.Core/Logging/LoggingConfiguration.cs
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,12 @@ public static LoggerConfiguration GetConfiguration()
.WriteTo.Console()
.WriteToSqlCustom();

// add in stackify sink if the api key is valid
if (!string.IsNullOrEmpty(loggingSection.GetValue<string>("ApiKey")))
{
logConfig = logConfig.WriteTo.Stackify();
}

// add in elastic search sink if the uri is valid
if (Uri.TryCreate(loggingSection.GetValue<string>("ElasticUrl"), UriKind.Absolute, out var elasticUri))
{
Expand Down
1 change: 1 addition & 0 deletions Sloth.Jobs.Core/Sloth.Jobs.Core.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
<PackageReference Include="Serilog.Sinks.Console" Version="4.0.1" />
<PackageReference Include="Serilog.Sinks.Elasticsearch" Version="8.4.1" />
<PackageReference Include="Serilog.Sinks.MSSqlServer" Version="5.7.1" />
<PackageReference Include="Serilog.Sinks.Stackify" Version="2.0.2" />
</ItemGroup>

</Project>
6 changes: 6 additions & 0 deletions Sloth.Web/Logging/LoggingConfiguration.cs
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,12 @@ public static LoggerConfiguration GetConfiguration()
logConfig = logConfig
.WriteTo.Console();

// add in stackify sink if the api key is valid
if (!string.IsNullOrEmpty(loggingSection.GetValue<string>("ApiKey")))
{
logConfig = logConfig.WriteTo.Stackify();
}

// add in elastic search sink if the uri is valid
if (Uri.TryCreate(loggingSection.GetValue<string>("ElasticUrl"), UriKind.Absolute, out var elasticUri))
{
Expand Down
1 change: 1 addition & 0 deletions Sloth.Web/Sloth.Web.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@
<PackageReference Include="Microsoft.AspNetCore.Mvc.Razor.RuntimeCompilation" Version="6.0.6" />
<PackageReference Include="Humanizer" Version="2.14.1" />
<PackageReference Include="ietws" Version="0.2.12" />
<PackageReference Include="Serilog.Sinks.Stackify" Version="2.0.2" />

<PackageReference Include="SSH.NET" Version="2020.0.2" />
</ItemGroup>
Expand Down