Skip to content

Commit 12a0727

Browse files
committed
stackify http layout renderer into separate project
1 parent d3b3af0 commit 12a0727

File tree

5 files changed

+69
-16
lines changed

5 files changed

+69
-16
lines changed

Src/NLog.Targets.Stackify/NLog.Targets.Stackify.csproj

Lines changed: 2 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,7 @@
2525

2626
<ItemGroup>
2727
<ProjectReference Include="..\StackifyLib\StackifyLib.csproj" />
28-
<PackageReference Include="NLog" Version="4.5.0" />
29-
<PackageReference Include="NLog.Config" Version="4.5.0" />
28+
<PackageReference Include="NLog" Version="4.5.11" />
3029
<PackageReference Include="Newtonsoft.Json" Version="9.0.1" />
3130
</ItemGroup>
3231

@@ -37,17 +36,5 @@
3736
<PropertyGroup Condition=" '$(TargetFramework)' == 'net40' OR '$(TargetFramework)' == 'net45' OR '$(TargetFramework)' == 'net461' ">
3837
<DefineConstants>NETFULL</DefineConstants>
3938
</PropertyGroup>
40-
<ItemGroup Condition=" '$(TargetFramework)' != 'netstandard2.0' ">
41-
<Reference Include="System.Web" />
42-
<Reference Include="System.Web.Abstractions" />
43-
<Reference Include="System.Web.Routing" />
44-
<PackageReference Include="NLog.Web" Version="4.5.0" />
45-
</ItemGroup>
46-
<ItemGroup Condition=" '$(TargetFramework)' == 'netstandard2.0'">
47-
<PackageReference Include="Microsoft.AspNetCore.Http" Version="2.1.1" />
48-
<PackageReference Include="Microsoft.AspNetCore.Hosting.Abstractions" Version="2.1.1" />
49-
<PackageReference Include="Microsoft.AspNetCore.Routing.Abstractions" Version="2.1.1" />
50-
<PackageReference Include="NLog.Web.AspNetCore" Version="4.5.0" />
51-
</ItemGroup>
52-
39+
5340
</Project>

Src/NLog.Targets.Stackify/StackifyTarget.cs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
using StackifyLib.Internal.Logs;
1010
using StackifyLib.Models;
1111
using StackifyLib.Utils;
12+
using NLog.Layouts;
1213

1314
namespace NLog.Targets.Stackify
1415
{
@@ -36,6 +37,8 @@ public class StackifyTarget : TargetWithContext
3637
[ArrayParameter(typeof(TargetPropertyWithContext), "contextproperty")]
3738
public override IList<TargetPropertyWithContext> ContextProperties { get; } = new List<TargetPropertyWithContext>();
3839

40+
public Layout StackifyHttpRequestInfo { get; set; }
41+
3942
public StackifyTarget()
4043
{
4144
Layout = "${message}${onexception:${newline}${exception:format=tostring}}";
Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
<Project Sdk="Microsoft.NET.Sdk">
2+
3+
<PropertyGroup>
4+
<AssemblyTitle>NLog.Web.Stackify</AssemblyTitle>
5+
<VersionPrefix>2.0.0</VersionPrefix>
6+
<TargetFrameworks>netstandard2.0;net40;net45;net461</TargetFrameworks>
7+
<AssemblyName>NLog.Web.Stackify</AssemblyName>
8+
<PackageId>NLog.Web.Stackify</PackageId>
9+
<PackageTags>stackify;errors;logs</PackageTags>
10+
<GenerateAssemblyTitleAttribute>false</GenerateAssemblyTitleAttribute>
11+
<GenerateAssemblyDescriptionAttribute>false</GenerateAssemblyDescriptionAttribute>
12+
<GenerateAssemblyConfigurationAttribute>false</GenerateAssemblyConfigurationAttribute>
13+
<GenerateAssemblyCompanyAttribute>false</GenerateAssemblyCompanyAttribute>
14+
<GenerateAssemblyProductAttribute>false</GenerateAssemblyProductAttribute>
15+
<GenerateAssemblyCopyrightAttribute>false</GenerateAssemblyCopyrightAttribute>
16+
<GenerateAssemblyVersionAttribute>false</GenerateAssemblyVersionAttribute>
17+
<GenerateAssemblyFileVersionAttribute>false</GenerateAssemblyFileVersionAttribute>
18+
<Version>2.1.1</Version>
19+
<PackageLicenseUrl>https://github.com/stackify/stackify-api-dotnet/blob/master/LICENSE</PackageLicenseUrl>
20+
<PackageProjectUrl>https://github.com/stackify/stackify-api-dotnet</PackageProjectUrl>
21+
<PackageIconUrl>https://stackify.com/wp-content/uploads/2017/02/stk.png</PackageIconUrl>
22+
<RepositoryUrl>https://github.com/stackify/stackify-api-dotnet</RepositoryUrl>
23+
<RepositoryType>git</RepositoryType>
24+
</PropertyGroup>
25+
26+
<ItemGroup>
27+
<ProjectReference Include="..\StackifyLib\StackifyLib.csproj" />
28+
<PackageReference Include="NLog" Version="4.5.11" />
29+
<PackageReference Include="Newtonsoft.Json" Version="9.0.1" />
30+
</ItemGroup>
31+
32+
<PropertyGroup Condition="'$(Configuration)|$(TargetFramework)|$(Platform)'=='Debug|netstandard2.0|AnyCPU'">
33+
<DefineConstants>NETCORE</DefineConstants>
34+
</PropertyGroup>
35+
36+
<PropertyGroup Condition=" '$(TargetFramework)' == 'net40' OR '$(TargetFramework)' == 'net45' OR '$(TargetFramework)' == 'net461' ">
37+
<DefineConstants>NETFULL</DefineConstants>
38+
</PropertyGroup>
39+
40+
<ItemGroup Condition=" '$(TargetFramework)' != 'netstandard2.0' ">
41+
<Reference Include="System.Web" />
42+
<Reference Include="System.Web.Abstractions" />
43+
<Reference Include="System.Web.Routing" />
44+
<PackageReference Include="NLog.Web" Version="4.8.0" />
45+
</ItemGroup>
46+
47+
<ItemGroup Condition=" '$(TargetFramework)' == 'netstandard2.0'">
48+
<PackageReference Include="NLog.Web.AspNetCore" Version="4.8.0" />
49+
</ItemGroup>
50+
</Project>

Src/NLog.Targets.Stackify/StackifyHttpLayoutRenderer.cs renamed to Src/NLog.Web.Stackify/StackifyHttpLayoutRenderer.cs

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,11 +7,17 @@
77
using StackifyLib.Models;
88
using Newtonsoft.Json;
99

10-
namespace NLog.Targets.Stackify
10+
namespace NLog.Web.Stackify
1111
{
1212
[LayoutRenderer("stackify-http")]
13+
[ThreadSafe]
1314
public class StackifyHttpLayoutRenderer : AspNetLayoutRendererBase
1415
{
16+
public StackifyHttpLayoutRenderer()
17+
{
18+
19+
}
20+
1521
protected override void DoAppend(StringBuilder builder, LogEventInfo logEvent)
1622
{
1723
var httpRequest = HttpContextAccessor.HttpContext;

Src/StackifyLibCore.sln

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,8 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Samples", "Samples", "{CA78
3131
EndProject
3232
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "StackifyLib.UnitTests", "..\test\StackifyLib.UnitTests\StackifyLib.UnitTests.csproj", "{0A9026C3-2A91-4A45-893C-17C6AF006FA0}"
3333
EndProject
34+
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "NLog.Web.Stackify", "NLog.Web.Stackify\NLog.Web.Stackify.csproj", "{647F27AD-13D7-40C2-A7BB-97A5D19CE3D5}"
35+
EndProject
3436
Global
3537
GlobalSection(SolutionConfigurationPlatforms) = preSolution
3638
Debug|Any CPU = Debug|Any CPU
@@ -81,6 +83,10 @@ Global
8183
{0A9026C3-2A91-4A45-893C-17C6AF006FA0}.Debug|Any CPU.Build.0 = Debug|Any CPU
8284
{0A9026C3-2A91-4A45-893C-17C6AF006FA0}.Release|Any CPU.ActiveCfg = Release|Any CPU
8385
{0A9026C3-2A91-4A45-893C-17C6AF006FA0}.Release|Any CPU.Build.0 = Release|Any CPU
86+
{647F27AD-13D7-40C2-A7BB-97A5D19CE3D5}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
87+
{647F27AD-13D7-40C2-A7BB-97A5D19CE3D5}.Debug|Any CPU.Build.0 = Debug|Any CPU
88+
{647F27AD-13D7-40C2-A7BB-97A5D19CE3D5}.Release|Any CPU.ActiveCfg = Release|Any CPU
89+
{647F27AD-13D7-40C2-A7BB-97A5D19CE3D5}.Release|Any CPU.Build.0 = Release|Any CPU
8490
EndGlobalSection
8591
GlobalSection(SolutionProperties) = preSolution
8692
HideSolutionNode = FALSE
@@ -96,6 +102,7 @@ Global
96102
{E141CDE4-501C-4533-8A2E-344522B1991E} = {709EEA1C-81B6-4369-AB25-6A03D4BEC75F}
97103
{28A61379-B316-480F-B45E-C622C42CAE8D} = {709EEA1C-81B6-4369-AB25-6A03D4BEC75F}
98104
{0A9026C3-2A91-4A45-893C-17C6AF006FA0} = {36B13547-8CBC-4985-9495-555500880F1D}
105+
{647F27AD-13D7-40C2-A7BB-97A5D19CE3D5} = {709EEA1C-81B6-4369-AB25-6A03D4BEC75F}
99106
EndGlobalSection
100107
GlobalSection(ExtensibilityGlobals) = postSolution
101108
SolutionGuid = {6AB55A24-BCFF-4641-90E0-7921CAD32F49}

0 commit comments

Comments
 (0)