Skip to content

Commit 55cfd64

Browse files
THREAD_NAME feature constant added for conditional compilation
Added the feature constant THREAD_NAME to Framework4.5 and Netstandard2.0
1 parent 3440e65 commit 55cfd64

File tree

2 files changed

+12
-4
lines changed

2 files changed

+12
-4
lines changed

src/Serilog.Enrichers.Thread/Enrichers/ThreadNameEnricher.cs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,14 +12,14 @@
1212
// See the License for the specific language governing permissions and
1313
// limitations under the License.
1414

15-
15+
#if THREAD_NAME
1616
using System.Threading;
1717
using Serilog.Core;
1818
using Serilog.Events;
1919

2020
namespace Serilog.Enrichers
2121
{
22-
#if NET45 || NETSTANDARD2_0
22+
2323
/// <summary>
2424
/// Enriches log events with a ThreadName property containing the
2525
/// </summary>
@@ -44,5 +44,5 @@ public void Enrich(LogEvent logEvent, ILogEventPropertyFactory propertyFactory)
4444
}
4545
}
4646
}
47-
#endif
48-
}
47+
}
48+
#endif

src/Serilog.Enrichers.Thread/Serilog.Enrichers.Thread.csproj

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,4 +28,12 @@
2828
<Reference Include="Microsoft.CSharp" />
2929
</ItemGroup>
3030

31+
<PropertyGroup Condition=" '$(TargetFramework)' == 'net45' ">
32+
<DefineConstants>$(DefineConstants);THREAD_NAME</DefineConstants>
33+
</PropertyGroup>
34+
35+
<PropertyGroup Condition=" '$(TargetFramework)' == 'netstandard2.0' ">
36+
<DefineConstants>$(DefineConstants);THREAD_NAME</DefineConstants>
37+
</PropertyGroup>
38+
3139
</Project>

0 commit comments

Comments
 (0)