Skip to content

Commit 79183b3

Browse files
committed
Added InternalLogger for connection attempt. Bumped to NLog 4.5
Signed-off-by: Rolf Kristensen <[email protected]>
1 parent d0e932a commit 79183b3

File tree

2 files changed

+10
-16
lines changed

2 files changed

+10
-16
lines changed

src/NLog.Targets.Fluentd/Fluentd.cs

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -121,7 +121,7 @@ protected void UnpackTo(Unpacker unpacker, IList<object> array, long arrayLength
121121
}
122122
}
123123

124-
public void UnpackTo(Unpacker unpacker, IDictionary<string, object> collection)
124+
public new void UnpackTo(Unpacker unpacker, IDictionary<string, object> collection)
125125
{
126126
long mapLength;
127127
if (!unpacker.ReadMapLength(out mapLength))
@@ -143,7 +143,7 @@ protected override IDictionary<string, object> UnpackFromCore(Unpacker unpacker)
143143
return retval;
144144
}
145145

146-
public void UnpackTo(Unpacker unpacker, object collection)
146+
public new void UnpackTo(Unpacker unpacker, object collection)
147147
{
148148
var dictionary = collection as IDictionary<string, object>;
149149
if (dictionary == null)
@@ -246,6 +246,7 @@ protected void EnsureConnected()
246246

247247
private void ConnectClient()
248248
{
249+
NLog.Common.InternalLogger.Debug("Fluentd Connecting to {0}:{1}", this.Host, this.Port);
249250
this.client.Connect(this.Host, this.Port);
250251
this.stream = this.client.GetStream();
251252
this.emitter = new FluentdEmitter(this.stream);
@@ -309,7 +310,7 @@ protected override void Write(LogEventInfo logEvent)
309310
}
310311
record.Add("stacktrace", transcodedFrames);
311312
}
312-
if (this.IncludeAllProperties && logEvent.Properties.Count > 0)
313+
if (this.IncludeAllProperties && logEvent.HasProperties)
313314
{
314315
foreach (var property in logEvent.Properties)
315316
{
@@ -344,7 +345,7 @@ protected override void Write(LogEventInfo logEvent)
344345

345346
private static object SerializePropertyValue(string propertyKey, object propertyValue)
346347
{
347-
if (propertyValue == null || Convert.GetTypeCode(propertyValue) != TypeCode.Object || propertyValue is decimal)
348+
if (propertyValue == null || Convert.GetTypeCode(propertyValue) != TypeCode.Object)
348349
{
349350
return propertyValue; // immutable
350351
}

src/NLog.Targets.Fluentd/NLog.Targets.Fluentd.csproj

Lines changed: 5 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
<PropertyGroup>
44
<TargetFrameworks>net35;net40;net45;netstandard2.0</TargetFrameworks>
5+
<DisableImplicitFrameworkReferences Condition=" '$(TargetFramework)' != 'netstandard2.0' ">true</DisableImplicitFrameworkReferences>
56

67
<Description>NLog Target that emits the log entries to a fluentd node</Description>
78
<Authors>Moriyoshi Koizumi</Authors>
@@ -18,22 +19,14 @@
1819
<RepositoryUrl>git://github.com/fluent/NLog.Targets.Fluentd</RepositoryUrl>
1920
</PropertyGroup>
2021

21-
<PropertyGroup Condition=" '$(TargetFramework)' != 'netstandard2.0' ">
22-
<DisableImplicitFrameworkReferences>true</DisableImplicitFrameworkReferences>
23-
</PropertyGroup>
22+
<ItemGroup>
23+
<PackageReference Include="NLog" Version="4.5.0" />
24+
<PackageReference Include="MsgPack.Cli" Version="0.9.2" />
25+
</ItemGroup>
2426

2527
<ItemGroup Condition=" '$(TargetFramework)' != 'netstandard2.0' ">
2628
<Reference Include="System" />
2729
<Reference Include="System.Core" />
28-
29-
<PackageReference Include="MsgPack.Cli" Version="0.8.0" />
30-
<PackageReference Include="NLog" Version="2.1.0.0" />
3130
</ItemGroup>
3231

33-
<ItemGroup Condition=" '$(TargetFramework)' == 'netstandard2.0' ">
34-
<PackageReference Include="MsgPack.Cli" Version="0.9.2" />
35-
<PackageReference Include="NLog" Version="4.5.0-rc03" />
36-
</ItemGroup>
37-
38-
3932
</Project>

0 commit comments

Comments
 (0)