Skip to content

Commit 764efdf

Browse files
Move ITextLogManager and migrate itext.commons to new logging framework
DEVSIX-5706
1 parent 6bb3701 commit 764efdf

File tree

171 files changed

+345
-203
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

171 files changed

+345
-203
lines changed

itext.tests/itext.commons.tests/itext.commons.tests.csproj

Lines changed: 58 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -35,17 +35,69 @@
3535
<NoWarn>CS1591;CS1570;CS1572;CS1573;CS1574;CS1580;CS1584;CS1658</NoWarn>
3636
</PropertyGroup>
3737
<ItemGroup>
38-
<Reference Include="Common.Logging, Version=3.4.1.0, Culture=neutral, PublicKeyToken=af08829b84f0328e, processorArchitecture=MSIL">
39-
<HintPath>$(SolutionDir)\packages\Common.Logging.3.4.1\lib\net40\Common.Logging.dll</HintPath>
40-
</Reference>
41-
<Reference Include="Common.Logging.Core, Version=3.4.1.0, Culture=neutral, PublicKeyToken=af08829b84f0328e, processorArchitecture=MSIL">
42-
<HintPath>$(SolutionDir)\packages\Common.Logging.Core.3.4.1\lib\net40\Common.Logging.Core.dll</HintPath>
43-
</Reference>
4438
<Reference Include="nunit.framework, Version=3.7.1.0, Culture=neutral, PublicKeyToken=2638cd05610744eb, processorArchitecture=MSIL">
4539
<HintPath>$(SolutionDir)\packages\NUnit.3.7.1\lib\net45\nunit.framework.dll</HintPath>
4640
</Reference>
41+
<Reference Include="Microsoft.Bcl.AsyncInterfaces, Version=5.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51">
42+
<HintPath>$(SolutionDir)\packages\Microsoft.Bcl.AsyncInterfaces.5.0.0\lib\net461\Microsoft.Bcl.AsyncInterfaces.dll</HintPath>
43+
<Private>True</Private>
44+
</Reference>
45+
<Reference Include="Microsoft.Extensions.DependencyInjection, Version=5.0.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60">
46+
<HintPath>$(SolutionDir)\packages\Microsoft.Extensions.DependencyInjection.5.0.0\lib\net461\Microsoft.Extensions.DependencyInjection.dll</HintPath>
47+
<Private>True</Private>
48+
</Reference>
49+
<Reference Include="Microsoft.Extensions.DependencyInjection.Abstractions, Version=5.0.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60">
50+
<HintPath>$(SolutionDir)\packages\Microsoft.Extensions.DependencyInjection.Abstractions.5.0.0\lib\net461\Microsoft.Extensions.DependencyInjection.Abstractions.dll</HintPath>
51+
<Private>True</Private>
52+
</Reference>
53+
<Reference Include="Microsoft.Extensions.Logging, Version=5.0.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60">
54+
<HintPath>$(SolutionDir)\packages\Microsoft.Extensions.Logging.5.0.0\lib\net461\Microsoft.Extensions.Logging.dll</HintPath>
55+
<Private>True</Private>
56+
</Reference>
57+
<Reference Include="Microsoft.Extensions.Logging.Abstractions, Version=5.0.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60">
58+
<HintPath>$(SolutionDir)\packages\Microsoft.Extensions.Logging.Abstractions.5.0.0\lib\net461\Microsoft.Extensions.Logging.Abstractions.dll</HintPath>
59+
<Private>True</Private>
60+
</Reference>
61+
<Reference Include="Microsoft.Extensions.Options, Version=5.0.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60">
62+
<HintPath>$(SolutionDir)\packages\Microsoft.Extensions.Options.5.0.0\lib\net461\Microsoft.Extensions.Options.dll</HintPath>
63+
<Private>True</Private>
64+
</Reference>
65+
<Reference Include="Microsoft.Extensions.Primitives, Version=5.0.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60">
66+
<HintPath>$(SolutionDir)\packages\Microsoft.Extensions.Primitives.5.0.0\lib\net461\Microsoft.Extensions.Primitives.dll</HintPath>
67+
<Private>True</Private>
68+
</Reference>
69+
<Reference Include="mscorlib" />
4770
<Reference Include="System" />
71+
<Reference Include="System.Buffers, Version=4.0.3.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51">
72+
<HintPath>$(SolutionDir)\packages\System.Buffers.4.5.1\lib\net461\System.Buffers.dll</HintPath>
73+
<Private>True</Private>
74+
</Reference>
4875
<Reference Include="System.Core" />
76+
<Reference Include="System.Diagnostics.DiagnosticSource, Version=5.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51">
77+
<HintPath>$(SolutionDir)\packages\System.Diagnostics.DiagnosticSource.5.0.0\lib\net46\System.Diagnostics.DiagnosticSource.dll</HintPath>
78+
<Private>True</Private>
79+
</Reference>
80+
<Reference Include="System.Memory, Version=4.0.1.1, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51">
81+
<HintPath>$(SolutionDir)\packages\System.Memory.4.5.4\lib\net461\System.Memory.dll</HintPath>
82+
<Private>True</Private>
83+
</Reference>
84+
<Reference Include="System.Numerics" />
85+
<Reference Include="System.Numerics.Vectors, Version=4.1.4.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
86+
<HintPath>$(SolutionDir)\packages\System.Numerics.Vectors.4.5.0\lib\net46\System.Numerics.Vectors.dll</HintPath>
87+
<Private>True</Private>
88+
</Reference>
89+
<Reference Include="System.Runtime.CompilerServices.Unsafe, Version=5.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
90+
<HintPath>$(SolutionDir)\packages\System.Runtime.CompilerServices.Unsafe.5.0.0\lib\net45\System.Runtime.CompilerServices.Unsafe.dll</HintPath>
91+
<Private>True</Private>
92+
</Reference>
93+
<Reference Include="System.Threading.Tasks.Extensions, Version=4.2.0.1, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51">
94+
<HintPath>$(SolutionDir)\packages\System.Threading.Tasks.Extensions.4.5.4\lib\net461\System.Threading.Tasks.Extensions.dll</HintPath>
95+
<Private>True</Private>
96+
</Reference>
97+
<Reference Include="System.ValueTuple, Version=4.0.3.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51">
98+
<HintPath>$(SolutionDir)\packages\System.ValueTuple.4.5.0\lib\net461\System.ValueTuple.dll</HintPath>
99+
<Private>True</Private>
100+
</Reference>
49101
</ItemGroup>
50102
<ItemGroup>
51103
<Compile Include="itext\commons\**\*.cs" />

itext.tests/itext.commons.tests/itext.commons.tests.netstandard.csproj

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,6 @@
3333
<Reference Include="System.Core" />
3434
</ItemGroup>
3535
<ItemGroup>
36-
<PackageReference Include="Common.Logging" Version="3.4.1" />
3736
<PackageReference Include="TeamCity.VSTest.TestAdapter" Version="1.0.0" />
3837
<PackageReference Include="NUnit" Version="3.7.1" />
3938
<PackageReference Include="NUnit3TestAdapter" Version="3.10.0" />

itext.tests/itext.commons.tests/itext/commons/ecosystem/TestConfigurationEvent.cs

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,17 +21,18 @@ You should have received a copy of the GNU Affero General Public License
2121
along with this program. If not, see <https://www.gnu.org/licenses/>.
2222
*/
2323
using System;
24-
using Common.Logging;
24+
using Microsoft.Extensions.Logging;
25+
using iText.Commons;
2526
using iText.Commons.Actions;
2627

2728
namespace iText.Commons.Ecosystem {
2829
public class TestConfigurationEvent : AbstractITextConfigurationEvent {
2930
public const String MESSAGE = "Test configuration event was processed";
3031

31-
private static readonly ILog LOGGER = LogManager.GetLogger(typeof(TestConfigurationEvent));
32+
private static readonly ILogger LOGGER = ITextLogManager.GetLogger(typeof(TestConfigurationEvent));
3233

3334
protected internal override void DoAction() {
34-
LOGGER.Warn(MESSAGE);
35+
LOGGER.LogWarning(MESSAGE);
3536
}
3637
}
3738
}

itext.tests/itext.commons.tests/packages.config

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,18 @@
22
<packages>
33
<package id="NUnit" version="3.7.1" targetFramework="net45" />
44
<package id="NUnit3TestAdapter" version="3.10.0" targetFramework="net45" />
5+
<package id="Microsoft.Bcl.AsyncInterfaces" version="5.0.0" targetFramework="net461" />
6+
<package id="Microsoft.Extensions.DependencyInjection" version="5.0.0" targetFramework="net461" />
7+
<package id="Microsoft.Extensions.DependencyInjection.Abstractions" version="5.0.0" targetFramework="net461" />
8+
<package id="Microsoft.Extensions.Logging" version="5.0.0" targetFramework="net461" />
9+
<package id="Microsoft.Extensions.Logging.Abstractions" version="5.0.0" targetFramework="net461" />
10+
<package id="Microsoft.Extensions.Options" version="5.0.0" targetFramework="net461" />
11+
<package id="Microsoft.Extensions.Primitives" version="5.0.0" targetFramework="net461" />
12+
<package id="System.Buffers" version="4.5.1" targetFramework="net461" />
13+
<package id="System.Diagnostics.DiagnosticSource" version="5.0.0" targetFramework="net461" />
14+
<package id="System.Memory" version="4.5.4" targetFramework="net461" />
15+
<package id="System.Numerics.Vectors" version="4.5.0" targetFramework="net461" />
16+
<package id="System.Runtime.CompilerServices.Unsafe" version="5.0.0" targetFramework="net461" />
17+
<package id="System.Threading.Tasks.Extensions" version="4.5.4" targetFramework="net461" />
18+
<package id="System.ValueTuple" version="4.5.0" targetFramework="net461" />
519
</packages>

itext.tests/itext.kernel.tests/itext/kernel/actions/ecosystem/TestConfigurationEvent.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,8 @@ You should have received a copy of the GNU Affero General Public License
2222
*/
2323
using System;
2424
using Microsoft.Extensions.Logging;
25+
using iText.Commons;
2526
using iText.Commons.Actions;
26-
using iText.IO;
2727

2828
namespace iText.Kernel.Actions.Ecosystem {
2929
public class TestConfigurationEvent : AbstractITextConfigurationEvent {

itext.tests/itext.pdftest.tests/itext.pdftest.tests.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
<OutputType>Library</OutputType>
99
<AppDesignerFolder>Properties</AppDesignerFolder>
1010
<AssemblyName>itext.pdftest.tests</AssemblyName>
11-
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>
11+
<TargetFrameworkVersion>v4.6.1</TargetFrameworkVersion>
1212
<FileAlignment>512</FileAlignment>
1313
<ProductVersion>8.0.30703</ProductVersion>
1414
<SchemaVersion>2.0</SchemaVersion>
Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,19 @@
11
<?xml version="1.0" encoding="utf-8"?>
22
<packages>
3-
<package id="Common.Logging" version="3.4.1" targetFramework="net40" />
4-
<package id="Common.Logging.Core" version="3.4.1" targetFramework="net40" />
53
<package id="NUnit" version="3.7.1" targetFramework="net45" />
4+
<package id="Microsoft.Bcl.AsyncInterfaces" version="5.0.0" targetFramework="net461" />
5+
<package id="Microsoft.Extensions.DependencyInjection" version="5.0.0" targetFramework="net461" />
6+
<package id="Microsoft.Extensions.DependencyInjection.Abstractions" version="5.0.0" targetFramework="net461" />
7+
<package id="Microsoft.Extensions.Logging" version="5.0.0" targetFramework="net461" />
8+
<package id="Microsoft.Extensions.Logging.Abstractions" version="5.0.0" targetFramework="net461" />
9+
<package id="Microsoft.Extensions.Options" version="5.0.0" targetFramework="net461" />
10+
<package id="Microsoft.Extensions.Primitives" version="5.0.0" targetFramework="net461" />
611
<package id="Portable.BouncyCastle" version="1.8.9" targetFramework="net40" />
12+
<package id="System.Buffers" version="4.5.1" targetFramework="net461" />
13+
<package id="System.Diagnostics.DiagnosticSource" version="5.0.0" targetFramework="net461" />
14+
<package id="System.Memory" version="4.5.4" targetFramework="net461" />
15+
<package id="System.Numerics.Vectors" version="4.5.0" targetFramework="net461" />
16+
<package id="System.Runtime.CompilerServices.Unsafe" version="5.0.0" targetFramework="net461" />
17+
<package id="System.Threading.Tasks.Extensions" version="4.5.4" targetFramework="net461" />
18+
<package id="System.ValueTuple" version="4.5.0" targetFramework="net461" />
719
</packages>

itext/itext.commons/itext.commons.csproj

Lines changed: 56 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -38,14 +38,66 @@
3838
<DocumentationFile>bin\Release\itext.commons.xml</DocumentationFile>
3939
</PropertyGroup>
4040
<ItemGroup>
41-
<Reference Include="Common.Logging, Version=3.4.1.0, Culture=neutral, PublicKeyToken=af08829b84f0328e">
42-
<HintPath>$(SolutionDir)\packages\Common.Logging.3.4.1\lib\net40\Common.Logging.dll</HintPath>
41+
<Reference Include="Microsoft.Bcl.AsyncInterfaces, Version=5.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51">
42+
<HintPath>$(SolutionDir)\packages\Microsoft.Bcl.AsyncInterfaces.5.0.0\lib\net461\Microsoft.Bcl.AsyncInterfaces.dll</HintPath>
43+
<Private>True</Private>
4344
</Reference>
44-
<Reference Include="Common.Logging.Core, Version=3.4.1.0, Culture=neutral, PublicKeyToken=af08829b84f0328e">
45-
<HintPath>$(SolutionDir)\packages\Common.Logging.Core.3.4.1\lib\net40\Common.Logging.Core.dll</HintPath>
45+
<Reference Include="Microsoft.Extensions.DependencyInjection, Version=5.0.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60">
46+
<HintPath>$(SolutionDir)\packages\Microsoft.Extensions.DependencyInjection.5.0.0\lib\net461\Microsoft.Extensions.DependencyInjection.dll</HintPath>
47+
<Private>True</Private>
4648
</Reference>
49+
<Reference Include="Microsoft.Extensions.DependencyInjection.Abstractions, Version=5.0.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60">
50+
<HintPath>$(SolutionDir)\packages\Microsoft.Extensions.DependencyInjection.Abstractions.5.0.0\lib\net461\Microsoft.Extensions.DependencyInjection.Abstractions.dll</HintPath>
51+
<Private>True</Private>
52+
</Reference>
53+
<Reference Include="Microsoft.Extensions.Logging, Version=5.0.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60">
54+
<HintPath>$(SolutionDir)\packages\Microsoft.Extensions.Logging.5.0.0\lib\net461\Microsoft.Extensions.Logging.dll</HintPath>
55+
<Private>True</Private>
56+
</Reference>
57+
<Reference Include="Microsoft.Extensions.Logging.Abstractions, Version=5.0.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60">
58+
<HintPath>$(SolutionDir)\packages\Microsoft.Extensions.Logging.Abstractions.5.0.0\lib\net461\Microsoft.Extensions.Logging.Abstractions.dll</HintPath>
59+
<Private>True</Private>
60+
</Reference>
61+
<Reference Include="Microsoft.Extensions.Options, Version=5.0.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60">
62+
<HintPath>$(SolutionDir)\packages\Microsoft.Extensions.Options.5.0.0\lib\net461\Microsoft.Extensions.Options.dll</HintPath>
63+
<Private>True</Private>
64+
</Reference>
65+
<Reference Include="Microsoft.Extensions.Primitives, Version=5.0.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60">
66+
<HintPath>$(SolutionDir)\packages\Microsoft.Extensions.Primitives.5.0.0\lib\net461\Microsoft.Extensions.Primitives.dll</HintPath>
67+
<Private>True</Private>
68+
</Reference>
69+
<Reference Include="mscorlib" />
4770
<Reference Include="System" />
71+
<Reference Include="System.Buffers, Version=4.0.3.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51">
72+
<HintPath>$(SolutionDir)\packages\System.Buffers.4.5.1\lib\net461\System.Buffers.dll</HintPath>
73+
<Private>True</Private>
74+
</Reference>
4875
<Reference Include="System.Core" />
76+
<Reference Include="System.Diagnostics.DiagnosticSource, Version=5.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51">
77+
<HintPath>$(SolutionDir)\packages\System.Diagnostics.DiagnosticSource.5.0.0\lib\net46\System.Diagnostics.DiagnosticSource.dll</HintPath>
78+
<Private>True</Private>
79+
</Reference>
80+
<Reference Include="System.Memory, Version=4.0.1.1, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51">
81+
<HintPath>$(SolutionDir)\packages\System.Memory.4.5.4\lib\net461\System.Memory.dll</HintPath>
82+
<Private>True</Private>
83+
</Reference>
84+
<Reference Include="System.Numerics" />
85+
<Reference Include="System.Numerics.Vectors, Version=4.1.4.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
86+
<HintPath>$(SolutionDir)\packages\System.Numerics.Vectors.4.5.0\lib\net46\System.Numerics.Vectors.dll</HintPath>
87+
<Private>True</Private>
88+
</Reference>
89+
<Reference Include="System.Runtime.CompilerServices.Unsafe, Version=5.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
90+
<HintPath>$(SolutionDir)\packages\System.Runtime.CompilerServices.Unsafe.5.0.0\lib\net45\System.Runtime.CompilerServices.Unsafe.dll</HintPath>
91+
<Private>True</Private>
92+
</Reference>
93+
<Reference Include="System.Threading.Tasks.Extensions, Version=4.2.0.1, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51">
94+
<HintPath>$(SolutionDir)\packages\System.Threading.Tasks.Extensions.4.5.4\lib\net461\System.Threading.Tasks.Extensions.dll</HintPath>
95+
<Private>True</Private>
96+
</Reference>
97+
<Reference Include="System.ValueTuple, Version=4.0.3.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51">
98+
<HintPath>$(SolutionDir)\packages\System.ValueTuple.4.5.0\lib\net461\System.ValueTuple.dll</HintPath>
99+
<Private>True</Private>
100+
</Reference>
49101
</ItemGroup>
50102
<ItemGroup>
51103
<Compile Include="itext\commons\**\*.cs" />

itext/itext.commons/itext.commons.netstandard.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,6 @@
3030
<PackageReference Include="System.Text.Encoding.CodePages" Version="4.3.0" />
3131
</ItemGroup>
3232
<ItemGroup>
33-
<PackageReference Include="Common.Logging" Version="3.4.1" />
33+
<PackageReference Include="Microsoft.Extensions.Logging" Version="5.0.0" />
3434
</ItemGroup>
3535
</Project>

itext/itext.io/itext/io/ITextLogManager.cs renamed to itext/itext.commons/itext/commons/ITextLogManager.cs

Lines changed: 10 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,48 +1,42 @@
1-
using System;
1+
using System;
22
using Microsoft.Extensions.Logging;
33

4-
namespace iText.IO
5-
{
4+
namespace iText.Commons {
65
/// <summary>
76
/// iText static log manager working with the <c>Microsoft.Extensions.Logging</c> framework. Use it to add iText
87
/// logs to your application. Call <see cref = "SetLoggerFactory" /> to set up a logger factory that will
98
/// receive iText log messages.
109
/// </summary>
11-
public static class ITextLogManager
12-
{
10+
public static class ITextLogManager {
1311
private static ILoggerFactory _loggerFactory;
1412

15-
static ITextLogManager()
16-
{
13+
static ITextLogManager() {
1714
_loggerFactory = new LoggerFactory();
1815
}
19-
16+
2017
/// <summary>
21-
/// Sets the implementation of <see cref="ILoggerFactory"/> to be used for creating <see cref="ILogger"/>
18+
/// Sets the implementation of <see cref="Microsoft.Extensions.Logging.ILoggerFactory"/> to be used for creating <see cref="Microsoft.Extensions.Logging.ILogger"/>
2219
/// objects.
2320
/// </summary>
2421
/// <param name="factory">The factory.</param>
25-
public static void SetLoggerFactory(ILoggerFactory factory)
26-
{
22+
public static void SetLoggerFactory(ILoggerFactory factory) {
2723
_loggerFactory = factory;
2824
}
2925

3026
/// <summary>
3127
/// Gets an instance of the used logger factory.
3228
/// </summary>
3329
/// <returns>The factory.</returns>
34-
public static ILoggerFactory GetLoggerFactory()
35-
{
30+
public static ILoggerFactory GetLoggerFactory() {
3631
return _loggerFactory;
3732
}
3833

3934
/// <summary>
40-
/// Creates a new <see cref="ILogger"/> instance using the full name of the given type.
35+
/// Creates a new <see cref="Microsoft.Extensions.Logging.ILogger"/> instance using the full name of the given type.
4136
/// </summary>
4237
/// <param name="type">The type.</param>
4338
/// <returns></returns>
44-
public static ILogger GetLogger(Type type)
45-
{
39+
public static ILogger GetLogger(Type type) {
4640
return _loggerFactory.CreateLogger(type);
4741
}
4842
}

0 commit comments

Comments
 (0)