Skip to content

Commit

Permalink
Added InternalLogger for connection attempt. Bumped to NLog 4.5
Browse files Browse the repository at this point in the history
Signed-off-by: Rolf Kristensen <sweaty1@hotmail.com>
  • Loading branch information
snakefoot committed Jun 19, 2021
1 parent d0e932a commit 79183b3
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 16 deletions.
9 changes: 5 additions & 4 deletions src/NLog.Targets.Fluentd/Fluentd.cs
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ protected void UnpackTo(Unpacker unpacker, IList<object> array, long arrayLength
}
}

public void UnpackTo(Unpacker unpacker, IDictionary<string, object> collection)
public new void UnpackTo(Unpacker unpacker, IDictionary<string, object> collection)
{
long mapLength;
if (!unpacker.ReadMapLength(out mapLength))
Expand All @@ -143,7 +143,7 @@ protected override IDictionary<string, object> UnpackFromCore(Unpacker unpacker)
return retval;
}

public void UnpackTo(Unpacker unpacker, object collection)
public new void UnpackTo(Unpacker unpacker, object collection)
{
var dictionary = collection as IDictionary<string, object>;
if (dictionary == null)
Expand Down Expand Up @@ -246,6 +246,7 @@ protected void EnsureConnected()

private void ConnectClient()
{
NLog.Common.InternalLogger.Debug("Fluentd Connecting to {0}:{1}", this.Host, this.Port);
this.client.Connect(this.Host, this.Port);
this.stream = this.client.GetStream();
this.emitter = new FluentdEmitter(this.stream);
Expand Down Expand Up @@ -309,7 +310,7 @@ protected override void Write(LogEventInfo logEvent)
}
record.Add("stacktrace", transcodedFrames);
}
if (this.IncludeAllProperties && logEvent.Properties.Count > 0)
if (this.IncludeAllProperties && logEvent.HasProperties)
{
foreach (var property in logEvent.Properties)
{
Expand Down Expand Up @@ -344,7 +345,7 @@ protected override void Write(LogEventInfo logEvent)

private static object SerializePropertyValue(string propertyKey, object propertyValue)
{
if (propertyValue == null || Convert.GetTypeCode(propertyValue) != TypeCode.Object || propertyValue is decimal)
if (propertyValue == null || Convert.GetTypeCode(propertyValue) != TypeCode.Object)
{
return propertyValue; // immutable
}
Expand Down
17 changes: 5 additions & 12 deletions src/NLog.Targets.Fluentd/NLog.Targets.Fluentd.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

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

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

<PropertyGroup Condition=" '$(TargetFramework)' != 'netstandard2.0' ">
<DisableImplicitFrameworkReferences>true</DisableImplicitFrameworkReferences>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="NLog" Version="4.5.0" />
<PackageReference Include="MsgPack.Cli" Version="0.9.2" />
</ItemGroup>

<ItemGroup Condition=" '$(TargetFramework)' != 'netstandard2.0' ">
<Reference Include="System" />
<Reference Include="System.Core" />

<PackageReference Include="MsgPack.Cli" Version="0.8.0" />
<PackageReference Include="NLog" Version="2.1.0.0" />
</ItemGroup>

<ItemGroup Condition=" '$(TargetFramework)' == 'netstandard2.0' ">
<PackageReference Include="MsgPack.Cli" Version="0.9.2" />
<PackageReference Include="NLog" Version="4.5.0-rc03" />
</ItemGroup>


</Project>

0 comments on commit 79183b3

Please sign in to comment.