Skip to content

Commit

Permalink
Removing LOGCONTEXT feature and #ifdefs
Browse files Browse the repository at this point in the history
  • Loading branch information
colin-young committed Feb 10, 2016
1 parent b3352df commit c65dc5b
Show file tree
Hide file tree
Showing 10 changed files with 22 additions and 23 deletions.
14 changes: 14 additions & 0 deletions build.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
for path in src/*/project.json; do
dirname="$(dirname "${path}")"
dnu restore ${dirname}
dnu build ${dirname} --framework dotnet5.4 --configuration Release --out .\artifacts\testbin;
dnu pack ${dirname} --framework dotnet5.4 --configuration Release --out .\artifacts\packages;
done

for path in test/*/project.json; do
dirname="$(dirname "${path}")"
dnu restore ${dirname}
dnu build ${dirname} --framework dotnet5.4 --configuration Release --out .\artifacts\testbin;
dnx -p ${dirname} test;
done

4 changes: 1 addition & 3 deletions src/Serilog/Context/ImmutableStack.cs
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@
// See the License for the specific language governing permissions and
// limitations under the License.

#if LOGCONTEXT
using System;
using System.Collections.Generic;
#if REMOTING
Expand Down Expand Up @@ -81,5 +80,4 @@ System.Collections.IEnumerator System.Collections.IEnumerable.GetEnumerator()
public T Top => _top;

}
}
#endif
}
5 changes: 1 addition & 4 deletions src/Serilog/Context/LogContext.cs
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@
// limitations under the License.


#if LOGCONTEXT
using System;
#if REMOTING
using System.Runtime.Remoting.Messaging;
Expand Down Expand Up @@ -260,6 +259,4 @@ sealed class Wrapper : MarshalByRefObject
}
#endif
}
}

#endif
}
2 changes: 0 additions & 2 deletions src/Serilog/Enrichers/LogContextEnricher.cs
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@
// See the License for the specific language governing permissions and
// limitations under the License.

#if LOGCONTEXT
using Serilog.Context;
using Serilog.Core;
using Serilog.Events;
Expand All @@ -27,4 +26,3 @@ public void Enrich(LogEvent logEvent, ILogEventPropertyFactory propertyFactory)
}
}
}
#endif
2 changes: 0 additions & 2 deletions src/Serilog/LoggerConfigurationExtensions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,6 @@ namespace Serilog
public static class LoggerConfigurationExtensions
{

#if LOGCONTEXT
/// <summary>
/// Enrich log events with properties from <see cref="Context.LogContext"/>.
/// </summary>
Expand All @@ -53,7 +52,6 @@ public static LoggerConfiguration FromLogContext(
if (enrichmentConfiguration == null) throw new ArgumentNullException(nameof(enrichmentConfiguration));
return enrichmentConfiguration.With<LogContextEnricher>();
}
#endif

/// <summary>
/// Enrich log events with a ThreadId property containing the current <see cref="Thread.ManagedThreadId"/>.
Expand Down
6 changes: 3 additions & 3 deletions src/Serilog/project.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
"net45": {
"compilationOptions": {
"keyFile": "../../assets/Serilog.snk",
"define": [ "APPSETTINGS", "LOGCONTEXT", "PROCESS", "FILE_IO", "PERIODIC_BATCHING", "REMOTING" ]
"define": [ "APPSETTINGS", "PROCESS", "FILE_IO", "PERIODIC_BATCHING", "REMOTING" ]
},
"frameworkAssemblies": {
"System.Configuration": ""
Expand All @@ -19,7 +19,7 @@
"dotnet5.1": {
"compilationOptions": {
"keyFile": "../../assets/Serilog.snk",
"define": [ "NO_APPDOMAIN", "LOGCONTEXT" ]
"define": [ "NO_APPDOMAIN" ]
},
"dependencies": {
"Microsoft.CSharp": "4.0.1-beta-23516",
Expand All @@ -39,7 +39,7 @@
"dotnet5.4": {
"compilationOptions": {
"keyFile": "../../assets/Serilog.snk",
"define": [ "ASYNCLOCAL", "LOGCONTEXT", "PROCESS", "FILE_IO", "PERIODIC_BATCHING", "NO_TIMER", "NO_APPDOMAIN", "USERNAMEFROMENV" ]
"define": [ "ASYNCLOCAL", "PROCESS", "FILE_IO", "PERIODIC_BATCHING", "NO_TIMER", "NO_APPDOMAIN", "USERNAMEFROMENV" ]

},
"dependencies": {
Expand Down
4 changes: 1 addition & 3 deletions test/Serilog.Tests/Context/LogContextTests.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
using System;
using System.IO;
#if LOGCONTEXT
using Xunit;
using Serilog.Context;
using Serilog.Events;
Expand Down Expand Up @@ -235,5 +234,4 @@ public bool IsCallable()
}
}
#endif
}
#endif
}
2 changes: 0 additions & 2 deletions test/Serilog.Tests/Settings/AppSettingsTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,6 @@ public void ProcessIdEnricherIsApplied()
}
#endif

#if LOGCONTEXT
[Fact]
public void LogContextEnricherIsApplied()
{
Expand All @@ -172,7 +171,6 @@ public void LogContextEnricherIsApplied()
Assert.NotNull(evt.Properties["A"].LiteralValue() as int?);
Assert.Equal(1, (int)evt.Properties["A"].LiteralValue());
}
#endif
}
}
#endif
2 changes: 0 additions & 2 deletions test/Serilog.Tests/Settings/KeyValuePairSettingsTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -72,9 +72,7 @@ public void FindsEventEnrichersWithinAnAssembly()
.ToList();


#if LOGCONTEXT
Assert.True(eventEnrichers.Contains("FromLogContext"));
#endif
#if !DOTNET5_1
Assert.True(eventEnrichers.Contains("WithEnvironmentUserName"));
Assert.True(eventEnrichers.Contains("WithMachineName"));
Expand Down
4 changes: 2 additions & 2 deletions test/Serilog.Tests/project.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,15 +23,15 @@
"dnx452": {
"compilationOptions": {
"keyFile": "../../assets/Serilog.snk",
"define": [ "APPSETTINGS", "LOGCONTEXT", "PROCESS", "FILE_IO", "PERIODIC_BATCHING", "INTERNAL_TESTS", "REMOTING" ]
"define": [ "APPSETTINGS", "PROCESS", "FILE_IO", "PERIODIC_BATCHING", "INTERNAL_TESTS", "REMOTING" ]
},
"frameworkAssemblies": {
"System.Configuration": ""
}
},
"dnxcore50": {
"compilationOptions": {
"define": [ "ASYNCLOCAL", "LOGCONTEXT", "FILE_IO", "PERIODIC_BATCHING", "NO_APPDOMAIN" ]
"define": [ "ASYNCLOCAL", "FILE_IO", "PERIODIC_BATCHING", "NO_APPDOMAIN" ]
},
"dependencies": {
"Microsoft.CSharp": "4.0.1-beta-23516",
Expand Down

0 comments on commit c65dc5b

Please sign in to comment.