Return-Path: X-Original-To: archive-asf-public-internal@cust-asf2.ponee.io Delivered-To: archive-asf-public-internal@cust-asf2.ponee.io Received: from cust-asf.ponee.io (cust-asf.ponee.io [163.172.22.183]) by cust-asf2.ponee.io (Postfix) with ESMTP id 03D8F200B96 for ; Thu, 6 Oct 2016 12:48:04 +0200 (CEST) Received: by cust-asf.ponee.io (Postfix) id 02955160AAD; Thu, 6 Oct 2016 10:48:04 +0000 (UTC) Delivered-To: archive-asf-public@cust-asf.ponee.io Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by cust-asf.ponee.io (Postfix) with SMTP id B766B160AF5 for ; Thu, 6 Oct 2016 12:48:01 +0200 (CEST) Received: (qmail 32538 invoked by uid 500); 6 Oct 2016 10:48:00 -0000 Mailing-List: contact commits-help@ignite.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@ignite.apache.org Delivered-To: mailing list commits@ignite.apache.org Received: (qmail 31791 invoked by uid 99); 6 Oct 2016 10:47:59 -0000 Received: from git1-us-west.apache.org (HELO git1-us-west.apache.org) (140.211.11.23) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 06 Oct 2016 10:47:59 +0000 Received: by git1-us-west.apache.org (ASF Mail Server at git1-us-west.apache.org, from userid 33) id AF252ED497; Thu, 6 Oct 2016 10:47:59 +0000 (UTC) Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit From: akuznetsov@apache.org To: commits@ignite.apache.org Date: Thu, 06 Oct 2016 10:48:36 -0000 Message-Id: <6522f90efae740118439242277a413ef@git.apache.org> In-Reply-To: <138f73a126574f3f9c73f152bf87483c@git.apache.org> References: <138f73a126574f3f9c73f152bf87483c@git.apache.org> X-Mailer: ASF-Git Admin Mailer Subject: [39/50] [abbrv] ignite git commit: IGNITE-3279 .NET: NLog logger archived-at: Thu, 06 Oct 2016 10:48:04 -0000 IGNITE-3279 .NET: NLog logger Project: http://git-wip-us.apache.org/repos/asf/ignite/repo Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/1c82cd04 Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/1c82cd04 Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/1c82cd04 Branch: refs/heads/ignite-3443 Commit: 1c82cd04fadc61ab5da02e1d395aedfb28a039da Parents: ae4ae71 Author: Pavel Tupitsyn Authored: Tue Aug 23 13:28:40 2016 +0300 Committer: Pavel Tupitsyn Committed: Mon Oct 3 14:08:01 2016 +0300 ---------------------------------------------------------------------- .../Apache.Ignite.Core.Tests.NuGet.csproj | 18 +- .../Apache.Ignite.Core.Tests.NuGet/NLogTest.cs | 82 +++++++++ .../packages.config | 13 +- .../Apache.Ignite.Core.Tests.csproj | 13 +- .../IgniteConfigurationSerializerTest.cs | 3 +- .../Log/NLogLoggerTest.cs | 166 +++++++++++++++++++ .../Apache.Ignite.NLog.csproj | 74 +++++++++ .../Apache.Ignite.NLog.nuspec | 50 ++++++ .../Apache.Ignite.NLog/Apache.Ignite.NLog.snk | Bin 0 -> 596 bytes .../Apache.Ignite.NLog/IgniteNLogLogger.cs | 125 ++++++++++++++ .../Properties/AssemblyInfo.cs | 40 +++++ .../dotnet/Apache.Ignite.NLog/packages.config | 4 + modules/platforms/dotnet/Apache.Ignite.sln | 14 ++ 13 files changed, 589 insertions(+), 13 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/ignite/blob/1c82cd04/modules/platforms/dotnet/Apache.Ignite.Core.Tests.NuGet/Apache.Ignite.Core.Tests.NuGet.csproj ---------------------------------------------------------------------- diff --git a/modules/platforms/dotnet/Apache.Ignite.Core.Tests.NuGet/Apache.Ignite.Core.Tests.NuGet.csproj b/modules/platforms/dotnet/Apache.Ignite.Core.Tests.NuGet/Apache.Ignite.Core.Tests.NuGet.csproj index 8c4c46b..f3f917e 100644 --- a/modules/platforms/dotnet/Apache.Ignite.Core.Tests.NuGet/Apache.Ignite.Core.Tests.NuGet.csproj +++ b/modules/platforms/dotnet/Apache.Ignite.Core.Tests.NuGet/Apache.Ignite.Core.Tests.NuGet.csproj @@ -72,17 +72,26 @@ False - packages\Apache.Ignite.1.6.0\lib\net40\Apache.Ignite.Core.dll + packages\Apache.Ignite.1.8.0\lib\net40\Apache.Ignite.Core.dll True False - packages\Apache.Ignite.Linq.1.6.0\lib\net40\Apache.Ignite.Linq.dll + packages\Apache.Ignite.Linq.1.8.0\lib\net40\Apache.Ignite.Linq.dll True False - packages\Apache.Ignite.AspNet.1.6.0\lib\net40\Apache.Ignite.AspNet.dll + packages\Apache.Ignite.AspNet.1.8.0\lib\net40\Apache.Ignite.AspNet.dll + True + + + False + packages\Apache.Ignite.NLog.1.8.0\lib\net40\Apache.Ignite.NLog.dll + True + + + packages\NLog.4.3.7\lib\net40\NLog.dll True @@ -103,6 +112,7 @@ + @@ -132,7 +142,7 @@ if not exist "$(TargetDir)Libs" md "$(TargetDir)Libs" -xcopy /s /y "$(SolutionDir)packages\Apache.Ignite.1.6.0\Libs\*.*" "$(TargetDir)Libs" +xcopy /s /y "$(SolutionDir)packages\Apache.Ignite.1.8.0\Libs\*.*" "$(TargetDir)Libs" http://git-wip-us.apache.org/repos/asf/ignite/blob/1c82cd04/modules/platforms/dotnet/Apache.Ignite.Core.Tests.NuGet/NLogTest.cs ---------------------------------------------------------------------- diff --git a/modules/platforms/dotnet/Apache.Ignite.Core.Tests.NuGet/NLogTest.cs b/modules/platforms/dotnet/Apache.Ignite.Core.Tests.NuGet/NLogTest.cs new file mode 100644 index 0000000..d3c58e1 --- /dev/null +++ b/modules/platforms/dotnet/Apache.Ignite.Core.Tests.NuGet/NLogTest.cs @@ -0,0 +1,82 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +namespace Apache.Ignite.Core.Tests.NuGet +{ + using System.Linq; + using Apache.Ignite.NLog; + using global::NLog; + using global::NLog.Config; + using global::NLog.Layouts; + using global::NLog.Targets; + using NUnit.Framework; + + /// + /// NLog test. + /// + public class NLogTest + { + /// + /// The log target. + /// + private MemoryTarget _logTarget; + + /// + /// Test set up. + /// + [SetUp] + public void SetUp() + { + var cfg = new LoggingConfiguration(); + + _logTarget = new MemoryTarget("mem") + { + Layout = new SimpleLayout("${Logger}|${Level}|${Message}|${exception}|${all-event-properties}") + }; + + cfg.AddTarget(_logTarget); + + cfg.AddRule(LogLevel.Trace, LogLevel.Error, _logTarget); + + LogManager.Configuration = cfg; + } + + /// + /// Tests the logger with Ignite. + /// + [Test] + public void TestIgniteStartup() + { + var cfg = new IgniteConfiguration + { + DiscoverySpi = TestUtil.GetLocalDiscoverySpi(), + Logger = new IgniteNLogLogger(LogManager.GetCurrentClassLogger()) + }; + + using (Ignition.Start(cfg)) + { + Assert.IsTrue(_logTarget.Logs.Contains( + string.Format("|Debug|Starting Ignite.NET {0}||", typeof(Ignition).Assembly.GetName().Version))); + + Assert.IsTrue(_logTarget.Logs.Any(x => x.Contains(">>> Topology snapshot."))); + } + + Assert.IsTrue(_logTarget.Logs.Contains( + "org.apache.ignite.internal.IgniteKernal|Debug|Grid is stopping.||")); + } + } +} http://git-wip-us.apache.org/repos/asf/ignite/blob/1c82cd04/modules/platforms/dotnet/Apache.Ignite.Core.Tests.NuGet/packages.config ---------------------------------------------------------------------- diff --git a/modules/platforms/dotnet/Apache.Ignite.Core.Tests.NuGet/packages.config b/modules/platforms/dotnet/Apache.Ignite.Core.Tests.NuGet/packages.config index 88d9cc2..30e71a1 100644 --- a/modules/platforms/dotnet/Apache.Ignite.Core.Tests.NuGet/packages.config +++ b/modules/platforms/dotnet/Apache.Ignite.Core.Tests.NuGet/packages.config @@ -1,5 +1,4 @@  - - - - - - + + + + + + + \ No newline at end of file http://git-wip-us.apache.org/repos/asf/ignite/blob/1c82cd04/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Apache.Ignite.Core.Tests.csproj ---------------------------------------------------------------------- diff --git a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Apache.Ignite.Core.Tests.csproj b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Apache.Ignite.Core.Tests.csproj index 2c6150c..ef62498 100644 --- a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Apache.Ignite.Core.Tests.csproj +++ b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Apache.Ignite.Core.Tests.csproj @@ -38,8 +38,12 @@ - - ..\libs\nunit-console-runner.dll + + ..\packages\NLog.4.3.7\lib\net40\NLog.dll + + + False + ..\packages\NUnit.Runners.2.6.3\tools\lib\nunit-console-runner.dll False @@ -54,6 +58,7 @@ + @@ -175,6 +180,10 @@ {5b571661-17f4-4f29-8c7d-0edb38ca9b55} Apache.Ignite.Linq + + {C6B58E4A-A2E9-4554-AD02-68CE6DA5CFB7} + Apache.Ignite.NLog + {27F7F3C6-BDDE-43A9-B565-856F8395A04B} Apache.Ignite http://git-wip-us.apache.org/repos/asf/ignite/blob/1c82cd04/modules/platforms/dotnet/Apache.Ignite.Core.Tests/IgniteConfigurationSerializerTest.cs ---------------------------------------------------------------------- diff --git a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/IgniteConfigurationSerializerTest.cs b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/IgniteConfigurationSerializerTest.cs index beb1e8d..bb703f5 100644 --- a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/IgniteConfigurationSerializerTest.cs +++ b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/IgniteConfigurationSerializerTest.cs @@ -46,6 +46,7 @@ namespace Apache.Ignite.Core.Tests using Apache.Ignite.Core.Log; using Apache.Ignite.Core.Tests.Binary; using Apache.Ignite.Core.Transactions; + using Apache.Ignite.NLog; using NUnit.Framework; /// @@ -549,7 +550,7 @@ namespace Apache.Ignite.Core.Tests }, IsLateAffinityAssignment = false, SpringConfigUrl = "test", - Logger = new TestLogger() + Logger = new IgniteNLogLogger() }; } http://git-wip-us.apache.org/repos/asf/ignite/blob/1c82cd04/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Log/NLogLoggerTest.cs ---------------------------------------------------------------------- diff --git a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Log/NLogLoggerTest.cs b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Log/NLogLoggerTest.cs new file mode 100644 index 0000000..7806ecd --- /dev/null +++ b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Log/NLogLoggerTest.cs @@ -0,0 +1,166 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +namespace Apache.Ignite.Core.Tests.Log +{ + using System; + using System.Globalization; + using System.Linq; + using Apache.Ignite.Core.Log; + using Apache.Ignite.NLog; + using global::NLog; + using global::NLog.Config; + using global::NLog.Layouts; + using global::NLog.Targets; + using NUnit.Framework; + using LogLevel = Apache.Ignite.Core.Log.LogLevel; + + /// + /// Tests the NLog integration. + /// + public class NLogLoggerTest + { + /** */ + private MemoryTarget _logTarget; + + /// + /// Test set up. + /// + [SetUp] + public void SetUp() + { + var cfg = new LoggingConfiguration(); + + _logTarget = new MemoryTarget("mem") + { + Layout = new SimpleLayout("${Logger}|${Level}|${Message}|${exception}|${all-event-properties}") + }; + + cfg.AddTarget(_logTarget); + + cfg.AddRule(global::NLog.LogLevel.Trace, global::NLog.LogLevel.Error, _logTarget); + + LogManager.Configuration = cfg; + } + + /// + /// Tests the log level conversion. + /// + [Test] + public void TestLogLevelConversion() + { + var levels = new[] { LogLevel.Trace, LogLevel.Info, LogLevel.Debug, LogLevel.Warn, LogLevel.Error }; + + var nLogger = new IgniteNLogLogger(LogManager.GetCurrentClassLogger()); + + foreach (var igniteLevel in levels) + { + var nlogLevel = IgniteNLogLogger.ConvertLogLevel(igniteLevel); + + Assert.AreEqual(igniteLevel.ToString(), nlogLevel.ToString()); + + + Assert.IsTrue(nLogger.IsEnabled(igniteLevel)); + } + } + + /// + /// Tests the logger in isolated environment. + /// + [Test] + public void TestLogging() + { + var nLogger = new IgniteNLogLogger(); + + // All parameters. + nLogger.Log(LogLevel.Trace, "msg{0}", new object[] {1}, CultureInfo.InvariantCulture, "category", + "java-err", new Exception("myException")); + + Assert.AreEqual("category|Trace|msg1|myException|nativeErrorInfo=java-err", GetLastLog()); + + // No Java error. + nLogger.Log(LogLevel.Info, "msg{0}", new object[] { 1 }, CultureInfo.InvariantCulture, "category", + null, new Exception("myException")); + + Assert.AreEqual("category|Info|msg1|myException|", GetLastLog()); + + // No exception. + nLogger.Log(LogLevel.Debug, "msg{0}", new object[] { 1 }, CultureInfo.InvariantCulture, "category", + null, null); + + Assert.AreEqual("category|Debug|msg1||", GetLastLog()); + + // No params. + nLogger.Log(LogLevel.Warn, "msg{0}", null, CultureInfo.InvariantCulture, "category", null, null); + + Assert.AreEqual("category|Warn|msg{0}||", GetLastLog()); + + // No formatter. + nLogger.Log(LogLevel.Error, "msg{0}", null, null, "category", null, null); + + Assert.AreEqual("category|Error|msg{0}||", GetLastLog()); + + // No category. + nLogger.Log(LogLevel.Error, "msg{0}", null, null, null, null, null); + + Assert.AreEqual("|Error|msg{0}||", GetLastLog()); + + // No message. + nLogger.Log(LogLevel.Error, null, null, null, null, null, null); + + Assert.AreEqual("|Error|||", GetLastLog()); + } + + /// + /// Tests the logger with Ignite. + /// + [Test] + public void TestIgniteStartup() + { + var cfg = new IgniteConfiguration(TestUtils.GetTestConfiguration()) + { + Logger = new IgniteNLogLogger(LogManager.GetLogger("foo")) + }; + + using (var ignite = Ignition.Start(cfg)) + { + Assert.IsTrue(_logTarget.Logs.Contains( + string.Format("|Debug|Starting Ignite.NET {0}||", typeof(Ignition).Assembly.GetName().Version))); + + Assert.IsTrue(_logTarget.Logs.Any(x => x.Contains(">>> Topology snapshot."))); + + Assert.IsInstanceOf(ignite.Logger); + + ignite.Logger.Info("Log from user code."); + + Assert.IsTrue(_logTarget.Logs.Contains("|Info|Log from user code.||")); + } + + Assert.IsTrue(_logTarget.Logs.Contains( + "org.apache.ignite.internal.IgniteKernal|Debug|Grid is stopping.||")); + } + + /// + /// Gets the last log. + /// + private string GetLastLog() + { + return _logTarget.Logs.Last(); + } + + } +} http://git-wip-us.apache.org/repos/asf/ignite/blob/1c82cd04/modules/platforms/dotnet/Apache.Ignite.NLog/Apache.Ignite.NLog.csproj ---------------------------------------------------------------------- diff --git a/modules/platforms/dotnet/Apache.Ignite.NLog/Apache.Ignite.NLog.csproj b/modules/platforms/dotnet/Apache.Ignite.NLog/Apache.Ignite.NLog.csproj new file mode 100644 index 0000000..c8d8705 --- /dev/null +++ b/modules/platforms/dotnet/Apache.Ignite.NLog/Apache.Ignite.NLog.csproj @@ -0,0 +1,74 @@ + + + + + Debug + AnyCPU + {C6B58E4A-A2E9-4554-AD02-68CE6DA5CFB7} + Library + Properties + Apache.Ignite.NLog + Apache.Ignite.NLog + v4.0 + 512 + + + true + full + false + bin\Debug\ + DEBUG;TRACE + prompt + 4 + + + pdbonly + true + bin\Release\ + TRACE + prompt + 4 + + + true + + + Apache.Ignite.NLog.snk + + + + ..\packages\NLog.4.3.7\lib\net40\NLog.dll + True + + + + + + + + + + + + + + + + {4CD2F726-7E2B-46C4-A5BA-057BB82EECB6} + Apache.Ignite.Core + + + + + + + + + + \ No newline at end of file http://git-wip-us.apache.org/repos/asf/ignite/blob/1c82cd04/modules/platforms/dotnet/Apache.Ignite.NLog/Apache.Ignite.NLog.nuspec ---------------------------------------------------------------------- diff --git a/modules/platforms/dotnet/Apache.Ignite.NLog/Apache.Ignite.NLog.nuspec b/modules/platforms/dotnet/Apache.Ignite.NLog/Apache.Ignite.NLog.nuspec new file mode 100644 index 0000000..765e26f --- /dev/null +++ b/modules/platforms/dotnet/Apache.Ignite.NLog/Apache.Ignite.NLog.nuspec @@ -0,0 +1,50 @@ + + + + + + + + + Apache.Ignite.NLog + Apache Ignite NLog Logger + + $version$ + Apache Ignite + Apache Software Foundation + http://www.apache.org/licenses/LICENSE-2.0 + https://ignite.apache.org/ + https://ignite.apache.org/images/logo_ignite_32_32.png + false + NLog Logger for Apache Ignite + + Copyright 2016 + Apache Ignite In-Memory Distributed Computing SQL NoSQL LINQ Grid Map Reduce Cache NLog logger + + + + + + \ No newline at end of file http://git-wip-us.apache.org/repos/asf/ignite/blob/1c82cd04/modules/platforms/dotnet/Apache.Ignite.NLog/Apache.Ignite.NLog.snk ---------------------------------------------------------------------- diff --git a/modules/platforms/dotnet/Apache.Ignite.NLog/Apache.Ignite.NLog.snk b/modules/platforms/dotnet/Apache.Ignite.NLog/Apache.Ignite.NLog.snk new file mode 100644 index 0000000..799e742 Binary files /dev/null and b/modules/platforms/dotnet/Apache.Ignite.NLog/Apache.Ignite.NLog.snk differ http://git-wip-us.apache.org/repos/asf/ignite/blob/1c82cd04/modules/platforms/dotnet/Apache.Ignite.NLog/IgniteNLogLogger.cs ---------------------------------------------------------------------- diff --git a/modules/platforms/dotnet/Apache.Ignite.NLog/IgniteNLogLogger.cs b/modules/platforms/dotnet/Apache.Ignite.NLog/IgniteNLogLogger.cs new file mode 100644 index 0000000..2730e37 --- /dev/null +++ b/modules/platforms/dotnet/Apache.Ignite.NLog/IgniteNLogLogger.cs @@ -0,0 +1,125 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +namespace Apache.Ignite.NLog +{ + using System; + using Apache.Ignite.Core.Impl.Common; + using global::NLog; + using ILogger = Apache.Ignite.Core.Log.ILogger; + using IgniteLogLevel = Apache.Ignite.Core.Log.LogLevel; + using NLogLogLevel = global::NLog.LogLevel; + + /// + /// Ignite NLog integration. + /// + public class IgniteNLogLogger : ILogger + { + /// + /// The NLog logger. + /// + private readonly Logger _logger; + + /// + /// Initializes a new instance of the class using the + /// to retrieve the NLog logger. + /// + public IgniteNLogLogger() : this(LogManager.GetCurrentClassLogger()) + { + // No-op. + } + + /// + /// Initializes a new instance of the class. + /// + /// The NLog logger instance. + public IgniteNLogLogger(Logger logger) + { + IgniteArgumentCheck.NotNull(logger, "logger"); + + _logger = logger; + } + + /// + /// Logs the specified message. + /// + /// The level. + /// The message. + /// The arguments to format . + /// Can be null (formatting will not occur). + /// The format provider. Can be null if is null. + /// The logging category name. + /// The native error information. + /// The exception. Can be null. + /// + public void Log(IgniteLogLevel level, string message, object[] args, IFormatProvider formatProvider, + string category, string nativeErrorInfo, Exception ex) + { + var logEvent = new LogEventInfo + { + Level = ConvertLogLevel(level), + Message = message, + FormatProvider = formatProvider, + Parameters = args, + Exception = ex, + LoggerName = category + }; + + if (nativeErrorInfo != null) + logEvent.Properties.Add("nativeErrorInfo", nativeErrorInfo); + + _logger.Log(logEvent); + } + + /// + /// Determines whether the specified log level is enabled. + /// + /// The level. + /// + /// Value indicating whether the specified log level is enabled + /// + /// + public bool IsEnabled(IgniteLogLevel level) + { + return _logger.IsEnabled(ConvertLogLevel(level)); + } + + /// + /// Converts the Ignite LogLevel to the NLog log level. + /// + /// The Ignite log level. + /// Corresponding NLog log level. + public static NLogLogLevel ConvertLogLevel(IgniteLogLevel level) + { + switch (level) + { + case IgniteLogLevel.Trace: + return NLogLogLevel.Trace; + case IgniteLogLevel.Debug: + return NLogLogLevel.Debug; + case IgniteLogLevel.Info: + return NLogLogLevel.Info; + case IgniteLogLevel.Warn: + return NLogLogLevel.Warn; + case IgniteLogLevel.Error: + return NLogLogLevel.Error; + default: + throw new ArgumentOutOfRangeException("level", level, "Invalid Ignite LogLevel."); + } + } + } +} http://git-wip-us.apache.org/repos/asf/ignite/blob/1c82cd04/modules/platforms/dotnet/Apache.Ignite.NLog/Properties/AssemblyInfo.cs ---------------------------------------------------------------------- diff --git a/modules/platforms/dotnet/Apache.Ignite.NLog/Properties/AssemblyInfo.cs b/modules/platforms/dotnet/Apache.Ignite.NLog/Properties/AssemblyInfo.cs new file mode 100644 index 0000000..6603836 --- /dev/null +++ b/modules/platforms/dotnet/Apache.Ignite.NLog/Properties/AssemblyInfo.cs @@ -0,0 +1,40 @@ +/* +* Licensed to the Apache Software Foundation (ASF) under one or more +* contributor license agreements. See the NOTICE file distributed with +* this work for additional information regarding copyright ownership. +* The ASF licenses this file to You under the Apache License, Version 2.0 +* (the "License"); you may not use this file except in compliance with +* the License. You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +using System; +using System.Reflection; +using System.Runtime.InteropServices; + +[assembly: AssemblyTitle("Apache.Ignite.NLog")] +[assembly: AssemblyDescription("Apache Ignite.NET NLog integration.")] +[assembly: AssemblyConfiguration("")] +[assembly: AssemblyCompany("Apache Software Foundation")] +[assembly: AssemblyProduct("Apache Ignite.NET")] +[assembly: AssemblyCopyright("Copyright © 2015")] +[assembly: AssemblyTrademark("")] +[assembly: AssemblyCulture("")] + +[assembly: ComVisible(false)] + +// The following GUID is for the ID of the typelib if this project is exposed to COM +[assembly: Guid("c6b58e4a-a2e9-4554-ad02-68ce6da5cfb7")] + +[assembly: AssemblyVersion("1.8.0.13244")] +[assembly: AssemblyFileVersion("1.8.0.13244")] +[assembly: AssemblyInformationalVersion("1.8.0")] + +[assembly: CLSCompliant(true)] http://git-wip-us.apache.org/repos/asf/ignite/blob/1c82cd04/modules/platforms/dotnet/Apache.Ignite.NLog/packages.config ---------------------------------------------------------------------- diff --git a/modules/platforms/dotnet/Apache.Ignite.NLog/packages.config b/modules/platforms/dotnet/Apache.Ignite.NLog/packages.config new file mode 100644 index 0000000..50aeb52 --- /dev/null +++ b/modules/platforms/dotnet/Apache.Ignite.NLog/packages.config @@ -0,0 +1,4 @@ + + + + \ No newline at end of file http://git-wip-us.apache.org/repos/asf/ignite/blob/1c82cd04/modules/platforms/dotnet/Apache.Ignite.sln ---------------------------------------------------------------------- diff --git a/modules/platforms/dotnet/Apache.Ignite.sln b/modules/platforms/dotnet/Apache.Ignite.sln index 8a3bf04..2978780 100644 --- a/modules/platforms/dotnet/Apache.Ignite.sln +++ b/modules/platforms/dotnet/Apache.Ignite.sln @@ -38,6 +38,8 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Apache.Ignite.AspNet", "Apa EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Apache.Ignite.AspNet.Tests", "Apache.Ignite.AspNet.Tests\Apache.Ignite.AspNet.Tests.csproj", "{18EA4C71-A11D-4AB1-8042-418F7559D84F}" EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Apache.Ignite.NLog", "Apache.Ignite.NLog\Apache.Ignite.NLog.csproj", "{C6B58E4A-A2E9-4554-AD02-68CE6DA5CFB7}" +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU @@ -188,6 +190,18 @@ Global {18EA4C71-A11D-4AB1-8042-418F7559D84F}.Release|x64.Build.0 = Release|Any CPU {18EA4C71-A11D-4AB1-8042-418F7559D84F}.Release|x86.ActiveCfg = Release|Any CPU {18EA4C71-A11D-4AB1-8042-418F7559D84F}.Release|x86.Build.0 = Release|Any CPU + {C6B58E4A-A2E9-4554-AD02-68CE6DA5CFB7}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {C6B58E4A-A2E9-4554-AD02-68CE6DA5CFB7}.Debug|Any CPU.Build.0 = Debug|Any CPU + {C6B58E4A-A2E9-4554-AD02-68CE6DA5CFB7}.Debug|x64.ActiveCfg = Debug|Any CPU + {C6B58E4A-A2E9-4554-AD02-68CE6DA5CFB7}.Debug|x64.Build.0 = Debug|Any CPU + {C6B58E4A-A2E9-4554-AD02-68CE6DA5CFB7}.Debug|x86.ActiveCfg = Debug|Any CPU + {C6B58E4A-A2E9-4554-AD02-68CE6DA5CFB7}.Debug|x86.Build.0 = Debug|Any CPU + {C6B58E4A-A2E9-4554-AD02-68CE6DA5CFB7}.Release|Any CPU.ActiveCfg = Release|Any CPU + {C6B58E4A-A2E9-4554-AD02-68CE6DA5CFB7}.Release|Any CPU.Build.0 = Release|Any CPU + {C6B58E4A-A2E9-4554-AD02-68CE6DA5CFB7}.Release|x64.ActiveCfg = Release|Any CPU + {C6B58E4A-A2E9-4554-AD02-68CE6DA5CFB7}.Release|x64.Build.0 = Release|Any CPU + {C6B58E4A-A2E9-4554-AD02-68CE6DA5CFB7}.Release|x86.ActiveCfg = Release|Any CPU + {C6B58E4A-A2E9-4554-AD02-68CE6DA5CFB7}.Release|x86.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE