Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions jsnlog/Infrastructure/LogMessageHelpers.cs
Original file line number Diff line number Diff line change
@@ -1,21 +1,21 @@
using System;
using System.Collections.Generic;
using Newtonsoft.Json;
using System.Text.Json;

namespace JSNLog.Infrastructure
{
internal class LogMessageHelpers
{
public static T DeserializeJson<T>(string json)
{
T result = JsonConvert.DeserializeObject<T>(json);
T result = JsonSerializer.Deserialize<T>(json);
return result;
}

public static bool IsPotentialJson(string msg)
{
string trimmedMsg = msg.Trim();
return (trimmedMsg.StartsWith("{") && trimmedMsg.EndsWith("}"));
return (trimmedMsg.StartsWith("{") && trimmedMsg.EndsWith("}"));
}

/// <summary>
Expand Down Expand Up @@ -71,7 +71,7 @@ public static bool IsJsonString(string msg)
/// <summary>
/// Takes a log message and finds out if it contains a valid JSON string.
/// If so, returns it unchanged.
///
///
/// Otherwise, surrounds the string with quotes (") and escapes the string for JavaScript.
/// </summary>
/// <param name="ms"></param>
Expand Down
14 changes: 7 additions & 7 deletions jsnlog/JSNLog.ClassLibrary.nuspec
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?xml version="1.0"?>
<package>
<metadata minClientVersion="2.8.6">
<id>JSNLog.ClassLibrary</id>
<id>JSNLog.ClassLibrary</id>
<version>0.0.0</version>
<title>JSNLog.ClassLibrary - Class library for JSNLog</title>
<authors>Matt Perdeck</authors>
Expand All @@ -19,7 +19,7 @@
* JSNLog
* CommonLogging - a copy of JSNLog, except for the id.
* JSNLog.ClassLibrary.nuspec - does not copy contents files or the readme.txt file, and does not depend on WebActivatorEx. For use in class libraries.

The CommonLogging NuGet package and the JSNLog package have the same dependencies
and files. This because CommonLogging is purely a convenience package - JSNLog
already builds on Common.Logging, so it is not really needed. Only reason it is there
Expand All @@ -30,9 +30,9 @@
in the other as well. -->
<dependency id="Common.Logging" version="3.3.1" />

<!--
The below definition causes NuGet to load version 2.1.0 if no version of
Microsoft.Owin has already been installed (it tries to install the LOWEST
<!--
The below definition causes NuGet to load version 2.1.0 if no version of
Microsoft.Owin has already been installed (it tries to install the LOWEST
possible version of a package).

This will work fine in a .Net 4.0 project. Note that versions past 2.1.0 no longer support .Net 4.0.
Expand All @@ -41,9 +41,9 @@
JSNLog project in its references) to the version that is actually installed in the project.
-->
<dependency id="Microsoft.Owin" version="2.1.0" />

<!-- Use low minimum version to make installation easier with old code -->
<dependency id="Newtonsoft.Json" version="9.0.1" />
<dependency id="System.Text.Json" version="4.6.0" />
</group>
</dependencies>
</metadata>
Expand Down
12 changes: 6 additions & 6 deletions jsnlog/JSNLog.nuspec
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?xml version="1.0"?>
<package>
<metadata minClientVersion="2.8.6">
<id>JSNLog</id>
<id>JSNLog</id>
<version>0.0.0</version>
<title>JSNLog - JavaScript Logging Package</title>
<authors>Matt Perdeck</authors>
Expand Down Expand Up @@ -31,9 +31,9 @@
<dependency id="Common.Logging" version="3.3.1" />
<dependency id="WebActivatorEx" version="2.0.0" />

<!--
The below definition causes NuGet to load version 2.1.0 if no version of
Microsoft.Owin has already been installed (it tries to install the LOWEST
<!--
The below definition causes NuGet to load version 2.1.0 if no version of
Microsoft.Owin has already been installed (it tries to install the LOWEST
possible version of a package).

This will work fine in a .Net 4.0 project. Note that versions past 2.1.0 no longer support .Net 4.0.
Expand All @@ -42,9 +42,9 @@
JSNLog project in its references) to the version that is actually installed in the project.
-->
<dependency id="Microsoft.Owin" version="2.1.0" />

<!-- Use low minimum version to make installation easier with old code -->
<dependency id="Newtonsoft.Json" version="9.0.1" />
<dependency id="System.Text.Json" version="4.6.0" />
</group>
</dependencies>
</metadata>
Expand Down
7 changes: 2 additions & 5 deletions jsnlog/jsnlog.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -39,22 +39,19 @@
<PackageReference Include="Microsoft.AspNetCore.Mvc" Version="2.1.*" />
<PackageReference Include="Microsoft.Extensions.Logging" Version="2.1.*" />
<PackageReference Include="Microsoft.AspNetCore.Mvc.TagHelpers" Version="2.1.*" />
<PackageReference Include="System.Text.Json" Version="4.6.0" />
</ItemGroup>

<ItemGroup Condition="('$(TargetFramework)' != 'netstandard2.0') AND ('$(TargetFramework)' != 'netstandard2.1')">
<FrameworkReference Include="Microsoft.AspNetCore.App" />
</ItemGroup>

<ItemGroup>
<PackageReference Include="Newtonsoft.Json" Version="11.0.2" />
</ItemGroup>

<ItemGroup>
<Content Include="NuGet\readme.txt">
<Pack>true</Pack>
<PackagePath>readme.txt</PackagePath>
</Content>
<None Include="NuGet\icon.png" Pack="true" PackagePath=""/>
<None Include="NuGet\icon.png" Pack="true" PackagePath="" />
</ItemGroup>
</Project>