Skip to content

Commit 68d6fbd

Browse files
committed
Initial flip over to .Net 3.5
1 parent d12db4f commit 68d6fbd

15 files changed

Lines changed: 101 additions & 29 deletions

File tree

Take2/NuLog.CLI.PerfTune/NuLog.CLI.PerfTune.csproj

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,16 @@
3232
<ErrorReport>prompt</ErrorReport>
3333
<WarningLevel>4</WarningLevel>
3434
</PropertyGroup>
35+
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Release-3.5|AnyCPU'">
36+
<OutputPath>bin\Release-3.5\</OutputPath>
37+
<DefineConstants>TRACE</DefineConstants>
38+
<Optimize>true</Optimize>
39+
<DebugType>pdbonly</DebugType>
40+
<PlatformTarget>AnyCPU</PlatformTarget>
41+
<ErrorReport>prompt</ErrorReport>
42+
<CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet>
43+
<Prefer32Bit>true</Prefer32Bit>
44+
</PropertyGroup>
3545
<ItemGroup>
3646
<Reference Include="System" />
3747
<Reference Include="System.Core" />

Take2/NuLog.Tests/NuLog.Tests.csproj

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,15 @@
3232
<ErrorReport>prompt</ErrorReport>
3333
<WarningLevel>4</WarningLevel>
3434
</PropertyGroup>
35+
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Release-3.5|AnyCPU'">
36+
<OutputPath>bin\Release-3.5\</OutputPath>
37+
<DefineConstants>TRACE</DefineConstants>
38+
<Optimize>true</Optimize>
39+
<DebugType>pdbonly</DebugType>
40+
<PlatformTarget>AnyCPU</PlatformTarget>
41+
<ErrorReport>prompt</ErrorReport>
42+
<CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet>
43+
</PropertyGroup>
3544
<ItemGroup>
3645
<Reference Include="FakeItEasy, Version=2.3.2.0, Culture=neutral, PublicKeyToken=eff28e2146d5fd2c, processorArchitecture=MSIL">
3746
<HintPath>..\packages\FakeItEasy.2.3.2\lib\net40\FakeItEasy.dll</HintPath>

Take2/NuLog.sln

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,20 +16,27 @@ Global
1616
GlobalSection(SolutionConfigurationPlatforms) = preSolution
1717
Debug|Any CPU = Debug|Any CPU
1818
Release|Any CPU = Release|Any CPU
19+
Release-3.5|Any CPU = Release-3.5|Any CPU
1920
EndGlobalSection
2021
GlobalSection(ProjectConfigurationPlatforms) = postSolution
2122
{100467BE-E1B1-4D5A-A40B-CA633015EC42}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
2223
{100467BE-E1B1-4D5A-A40B-CA633015EC42}.Debug|Any CPU.Build.0 = Debug|Any CPU
2324
{100467BE-E1B1-4D5A-A40B-CA633015EC42}.Release|Any CPU.ActiveCfg = Release|Any CPU
2425
{100467BE-E1B1-4D5A-A40B-CA633015EC42}.Release|Any CPU.Build.0 = Release|Any CPU
26+
{100467BE-E1B1-4D5A-A40B-CA633015EC42}.Release-3.5|Any CPU.ActiveCfg = Release-3.5|Any CPU
27+
{100467BE-E1B1-4D5A-A40B-CA633015EC42}.Release-3.5|Any CPU.Build.0 = Release-3.5|Any CPU
2528
{ED0E44F6-7945-4B80-BD29-168065AD01D5}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
2629
{ED0E44F6-7945-4B80-BD29-168065AD01D5}.Debug|Any CPU.Build.0 = Debug|Any CPU
2730
{ED0E44F6-7945-4B80-BD29-168065AD01D5}.Release|Any CPU.ActiveCfg = Release|Any CPU
2831
{ED0E44F6-7945-4B80-BD29-168065AD01D5}.Release|Any CPU.Build.0 = Release|Any CPU
32+
{ED0E44F6-7945-4B80-BD29-168065AD01D5}.Release-3.5|Any CPU.ActiveCfg = Release-3.5|Any CPU
33+
{ED0E44F6-7945-4B80-BD29-168065AD01D5}.Release-3.5|Any CPU.Build.0 = Release-3.5|Any CPU
2934
{40A62D51-DE30-4C8A-BD5F-157189E0C8B5}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
3035
{40A62D51-DE30-4C8A-BD5F-157189E0C8B5}.Debug|Any CPU.Build.0 = Debug|Any CPU
3136
{40A62D51-DE30-4C8A-BD5F-157189E0C8B5}.Release|Any CPU.ActiveCfg = Release|Any CPU
3237
{40A62D51-DE30-4C8A-BD5F-157189E0C8B5}.Release|Any CPU.Build.0 = Release|Any CPU
38+
{40A62D51-DE30-4C8A-BD5F-157189E0C8B5}.Release-3.5|Any CPU.ActiveCfg = Release-3.5|Any CPU
39+
{40A62D51-DE30-4C8A-BD5F-157189E0C8B5}.Release-3.5|Any CPU.Build.0 = Release-3.5|Any CPU
3340
EndGlobalSection
3441
GlobalSection(SolutionProperties) = preSolution
3542
HideSolutionNode = FALSE

Take2/NuLog/Dispatchers/StandardDispatcher.cs

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,8 @@
55
using NuLog.Dispatchers.TagRouters;
66
using NuLog.Loggers;
77
using System;
8-
using System.Collections.Concurrent;
8+
9+
//TODO: using System.Collections.Concurrent;
910
using System.Collections.Generic;
1011
using System.Diagnostics;
1112
using System.Linq;
@@ -36,7 +37,8 @@ public class StandardDispatcher : IDispatcher
3637
/// <summary>
3738
/// A queue for storing log events to be dispatched.
3839
/// </summary>
39-
private readonly ConcurrentQueue<ILogEvent> logEventQueue;
40+
//TODO: private readonly ConcurrentQueue<ILogEvent> logEventQueue;
41+
private readonly Queue<ILogEvent> logEventQueue;
4042

4143
/// <summary>
4244
/// The timer for processing the log queue.
@@ -60,7 +62,8 @@ public StandardDispatcher(IEnumerable<ITarget> targets, ITagRouter tagRouter, IF
6062

6163
this.fallbackLogger = fallbackLogger;
6264

63-
this.logEventQueue = new ConcurrentQueue<ILogEvent>();
65+
//TODO: this.logEventQueue = new ConcurrentQueue<ILogEvent>();
66+
this.logEventQueue = new Queue<ILogEvent>();
6467

6568
this.logEventQueueTimer = new Timer(OnLogQueueTimerElapsed, this, 200, 200);
6669
}
@@ -189,9 +192,14 @@ private static void OnLogQueueTimerElapsed(object dispatcherInstance)
189192
/// </summary>
190193
protected void ProcessLogQueue()
191194
{
192-
ILogEvent logEvent;
193-
while (this.logEventQueue.TryDequeue(out logEvent))
195+
//TODO: ILogEvent logEvent;
196+
//while (this.logEventQueue.TryDequeue(out logEvent))
197+
//{
198+
// DispatchNow(logEvent);
199+
//}
200+
while (this.logEventQueue.Count > 0)
194201
{
202+
var logEvent = this.logEventQueue.Dequeue();
195203
DispatchNow(logEvent);
196204
}
197205
}

Take2/NuLog/Factories/StandardLoggerFactory.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@
1414
using NuLog.Targets;
1515
using System;
1616
using System.Collections.Generic;
17-
using System.Collections.ObjectModel;
1817

1918
namespace NuLog.Factories
2019
{
@@ -119,7 +118,8 @@ protected IDictionary<string, object> DefaultMetaData
119118
{
120119
if (_defaultMetaData == null)
121120
{
122-
_defaultMetaData = new ReadOnlyDictionary<string, object>(ToMetaData(Config.MetaData));
121+
//TODO: _defaultMetaData = new ReadOnlyDictionary<string, object>(ToMetaData(Config.MetaData));
122+
_defaultMetaData = new Dictionary<string, object>(ToMetaData(Config.MetaData));
123123
}
124124
}
125125
}

Take2/NuLog/FallbackLoggers/StandardFallbackLoggerBase.cs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
using NuLog.Dispatchers;
66
using NuLog.LogEvents;
77
using System;
8+
using System.Linq;
89

910
namespace NuLog.FallbackLoggers
1011
{
@@ -35,7 +36,8 @@ private static string GetMessage(ILogEvent logEvent)
3536

3637
private static string JoinTags(ILogEvent logEvent)
3738
{
38-
return logEvent.Tags != null ? string.Join(",", logEvent.Tags) : string.Empty;
39+
//TODO: return logEvent.Tags != null ? string.Join(",", logEvent.Tags) : string.Empty;
40+
return logEvent.Tags != null ? string.Join(",", logEvent.Tags.ToArray()) : string.Empty;
3941
}
4042

4143
private static string GetExceptionMessage(ILogEvent logEvent)

Take2/NuLog/ILogEvent.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ public interface ILogEvent : IDisposable
1515
/// <summary>
1616
/// The list of tags associated with the log event
1717
/// </summary>
18-
IEnumerable<string> Tags { get; set; }
18+
ICollection<string> Tags { get; set; }
1919

2020
/// <summary>
2121
/// the log event is to write itself to the given target.

Take2/NuLog/Layouts/StandardLayout.cs

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
using System;
88
using System.Collections;
99
using System.Collections.Generic;
10+
using System.Linq;
1011
using System.Text;
1112

1213
namespace NuLog.Layouts
@@ -127,7 +128,8 @@ protected virtual object GetSpecialParameter(LogEvent logEvent, LayoutParameter
127128
switch (parameter.Path)
128129
{
129130
case "Tags":
130-
return logEvent.Tags != null ? string.Join(",", logEvent.Tags) : string.Empty;
131+
//TODO: return logEvent.Tags != null ? string.Join(",", logEvent.Tags) : string.Empty;
132+
return logEvent.Tags != null ? string.Join(",", logEvent.Tags.ToArray()) : string.Empty;
131133

132134
case "Exception":
133135
return FormatException(logEvent.Exception);
@@ -177,7 +179,7 @@ private static string GetFormattedValue(object value, string format)
177179
}
178180

179181
// If we have a string format, use that.
180-
if (string.IsNullOrWhiteSpace(format) == false)
182+
if (string.IsNullOrEmpty(format) == false)
181183
{
182184
return string.Format(format, value);
183185
}
@@ -202,12 +204,16 @@ private static string GetFormattedValue(object value, string format)
202204
/// <summary>
203205
/// Enumerates the values in the given enumerable value.
204206
/// </summary>
205-
private static IEnumerable<string> EnumerateValues(IEnumerable items)
207+
private static string[] EnumerateValues(IEnumerable items)
206208
{
209+
var list = new List<string>();
210+
207211
foreach (var item in items)
208212
{
209-
yield return Convert.ToString(item);
213+
list.Add(Convert.ToString(item));
210214
}
215+
216+
return list.ToArray();
211217
}
212218
}
213219
}

Take2/NuLog/LogEvents/LogEvent.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ public class LogEvent : ILogEvent
4141
/// <summary>
4242
/// The list of tags associated with the log event
4343
/// </summary>
44-
public IEnumerable<string> Tags { get; set; }
44+
public ICollection<string> Tags { get; set; }
4545

4646
/// <summary>
4747
/// The exception (if any) associated with the log event

Take2/NuLog/Loggers/ITagNormalizer.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,6 @@ public interface ITagNormalizer
2323
/// <summary>
2424
/// Normalizes and validates a list of tags. Expected to use the same logic as for a single tag.
2525
/// </summary>
26-
IEnumerable<string> NormalizeTags(IEnumerable<string> tags);
26+
ICollection<string> NormalizeTags(IEnumerable<string> tags);
2727
}
2828
}

0 commit comments

Comments
 (0)