Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Merge pull request #5 from davidduffett/master

NLog LogFactory implementation
  • Loading branch information...
commit 10cf2be031d22d4281cb685b215d2ed0bb1918c6 2 parents 8455dc9 + 9863bb3
@schourode authored
Showing with 89,150 additions and 0 deletions.
  1. +61 −0 src/NCron.Integration.NLog/NCron.Integration.NLog.csproj
  2. +80 −0 src/NCron.Integration.NLog/NLogFactory.cs
  3. +7 −0 src/NCron.Integration.NLog/Properties/AssemblyInfo.cs
  4. +4 −0 src/NCron.Integration.NLog/packages.config
  5. +40 −0 src/NCron.sln
  6. BIN  src/packages/NLog.2.0.0.2000/lib/net20/NLog.dll
  7. +14,286 −0 src/packages/NLog.2.0.0.2000/lib/net20/NLog.xml
  8. BIN  src/packages/NLog.2.0.0.2000/lib/net35/NLog.dll
  9. +14,403 −0 src/packages/NLog.2.0.0.2000/lib/net35/NLog.xml
  10. BIN  src/packages/NLog.2.0.0.2000/lib/net40/NLog.dll
  11. +14,353 −0 src/packages/NLog.2.0.0.2000/lib/net40/NLog.xml
  12. BIN  src/packages/NLog.2.0.0.2000/lib/sl2/NLog.dll
  13. +9,119 −0 src/packages/NLog.2.0.0.2000/lib/sl2/NLog.xml
  14. BIN  src/packages/NLog.2.0.0.2000/lib/sl3-wp/NLog.dll
  15. +8,978 −0 src/packages/NLog.2.0.0.2000/lib/sl3-wp/NLog.xml
  16. BIN  src/packages/NLog.2.0.0.2000/lib/sl3/NLog.dll
  17. +9,141 −0 src/packages/NLog.2.0.0.2000/lib/sl3/NLog.xml
  18. BIN  src/packages/NLog.2.0.0.2000/lib/sl4-windowsphone71/NLog.dll
  19. +9,135 −0 src/packages/NLog.2.0.0.2000/lib/sl4-windowsphone71/NLog.xml
  20. BIN  src/packages/NLog.2.0.0.2000/lib/sl4/NLog.dll
  21. +9,542 −0 src/packages/NLog.2.0.0.2000/lib/sl4/NLog.xml
  22. +1 −0  src/packages/repositories.config
View
61 src/NCron.Integration.NLog/NCron.Integration.NLog.csproj
@@ -0,0 +1,61 @@
+<?xml version="1.0" encoding="utf-8"?>
+<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+ <PropertyGroup>
+ <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
+ <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
+ <ProductVersion>8.0.30703</ProductVersion>
+ <SchemaVersion>2.0</SchemaVersion>
+ <ProjectGuid>{DD07185B-00FA-4893-869C-A0E731F2E79F}</ProjectGuid>
+ <OutputType>Library</OutputType>
+ <AppDesignerFolder>Properties</AppDesignerFolder>
+ <RootNamespace>NCron.Integration.NLog</RootNamespace>
+ <AssemblyName>NCron.Integration.NLog</AssemblyName>
+ <TargetFrameworkVersion>v4.0</TargetFrameworkVersion>
+ <FileAlignment>512</FileAlignment>
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
+ <DebugSymbols>true</DebugSymbols>
+ <DebugType>full</DebugType>
+ <Optimize>false</Optimize>
+ <OutputPath>bin\Debug\</OutputPath>
+ <DefineConstants>DEBUG;TRACE</DefineConstants>
+ <ErrorReport>prompt</ErrorReport>
+ <WarningLevel>4</WarningLevel>
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
+ <DebugType>pdbonly</DebugType>
+ <Optimize>true</Optimize>
+ <OutputPath>bin\Release\</OutputPath>
+ <DefineConstants>TRACE</DefineConstants>
+ <ErrorReport>prompt</ErrorReport>
+ <WarningLevel>4</WarningLevel>
+ </PropertyGroup>
+ <ItemGroup>
+ <Reference Include="NLog">
+ <HintPath>..\packages\NLog.2.0.0.2000\lib\net40\NLog.dll</HintPath>
+ </Reference>
+ <Reference Include="System" />
+ <Reference Include="System.Core" />
+ </ItemGroup>
+ <ItemGroup>
+ <Compile Include="NLogFactory.cs" />
+ <Compile Include="Properties\AssemblyInfo.cs" />
+ </ItemGroup>
+ <ItemGroup>
+ <ProjectReference Include="..\NCron\NCron.csproj">
+ <Project>{31EB7758-6551-4FEE-A8A0-6B2449DD1DC7}</Project>
+ <Name>NCron</Name>
+ </ProjectReference>
+ </ItemGroup>
+ <ItemGroup>
+ <None Include="packages.config" />
+ </ItemGroup>
+ <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
+ <!-- To modify your build process, add your task inside one of the targets below and uncomment it.
+ Other similar extension points exist, see Microsoft.Common.targets.
+ <Target Name="BeforeBuild">
+ </Target>
+ <Target Name="AfterBuild">
+ </Target>
+ -->
+</Project>
View
80 src/NCron.Integration.NLog/NLogFactory.cs
@@ -0,0 +1,80 @@
+using System;
+using NCron.Logging;
+using NLog;
+
+namespace NCron.Integration.NLog
+{
+ /// <summary>
+ /// Implements the <see cref="Logging.ILogFactory"/> interface using "NLog" as log provider.
+ /// </summary>
+ public class NLogFactory : ILogFactory
+ {
+ public ILog GetLogForJob(ICronJob job)
+ {
+ var nlogger = LogManager.GetLogger(job.GetType().FullName);
+ return new LogAdapter(nlogger);
+ }
+
+ internal class LogAdapter : ILog
+ {
+ private readonly Logger _log;
+
+ public LogAdapter(Logger log)
+ {
+ _log = log;
+ }
+
+ public void Debug(Func<string> msgCallback)
+ {
+ if (_log.IsDebugEnabled)
+ _log.Debug(msgCallback());
+ }
+
+ public void Debug(Func<string> msgCallback, Func<Exception> exCallback)
+ {
+ if (_log.IsDebugEnabled)
+ _log.Debug(msgCallback(), exCallback());
+ }
+
+ public void Info(Func<string> msgCallback)
+ {
+ if (_log.IsInfoEnabled)
+ _log.Info(msgCallback());
+ }
+
+ public void Info(Func<string> msgCallback, Func<Exception> exCallback)
+ {
+ if (_log.IsInfoEnabled)
+ _log.Info(msgCallback(), exCallback());
+ }
+
+ public void Warn(Func<string> msgCallback)
+ {
+ if (_log.IsWarnEnabled)
+ _log.Warn(msgCallback());
+ }
+
+ public void Warn(Func<string> msgCallback, Func<Exception> exCallback)
+ {
+ if (_log.IsWarnEnabled)
+ _log.Warn(msgCallback(), exCallback());
+ }
+
+ public void Error(Func<string> msgCallback)
+ {
+ if (_log.IsErrorEnabled)
+ _log.Error(msgCallback());
+ }
+
+ public void Error(Func<string> msgCallback, Func<Exception> exCallback)
+ {
+ if (_log.IsErrorEnabled)
+ _log.Error(msgCallback(), exCallback());
+ }
+
+ public void Dispose()
+ {
+ }
+ }
+ }
+}
View
7 src/NCron.Integration.NLog/Properties/AssemblyInfo.cs
@@ -0,0 +1,7 @@
+using System.Reflection;
+using System.Runtime.InteropServices;
+
+[assembly: AssemblyTitle("NCron NLog integration")]
+[assembly: AssemblyDescription("Provides a log factory and log implementation for NCron based on the NLog library.")]
+
+[assembly: ComVisible(false)]
View
4 src/NCron.Integration.NLog/packages.config
@@ -0,0 +1,4 @@
+<?xml version="1.0" encoding="utf-8"?>
+<packages>
+ <package id="NLog" version="2.0.0.2000" targetFramework="net40" />
+</packages>
View
40 src/NCron.sln
@@ -14,28 +14,68 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "NCron.Integration.Autofac",
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Tests.NCron", "Tests.NCron\Tests.NCron.csproj", "{C5769DEB-C50A-4AAB-90E5-83FB7DEEBDBD}"
EndProject
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "NCron.Integration.NLog", "NCron.Integration.NLog\NCron.Integration.NLog.csproj", "{DD07185B-00FA-4893-869C-A0E731F2E79F}"
+EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
+ Debug|Mixed Platforms = Debug|Mixed Platforms
+ Debug|x86 = Debug|x86
Release|Any CPU = Release|Any CPU
+ Release|Mixed Platforms = Release|Mixed Platforms
+ Release|x86 = Release|x86
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{31EB7758-6551-4FEE-A8A0-6B2449DD1DC7}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{31EB7758-6551-4FEE-A8A0-6B2449DD1DC7}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {31EB7758-6551-4FEE-A8A0-6B2449DD1DC7}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU
+ {31EB7758-6551-4FEE-A8A0-6B2449DD1DC7}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU
+ {31EB7758-6551-4FEE-A8A0-6B2449DD1DC7}.Debug|x86.ActiveCfg = Debug|Any CPU
{31EB7758-6551-4FEE-A8A0-6B2449DD1DC7}.Release|Any CPU.ActiveCfg = Release|Any CPU
{31EB7758-6551-4FEE-A8A0-6B2449DD1DC7}.Release|Any CPU.Build.0 = Release|Any CPU
+ {31EB7758-6551-4FEE-A8A0-6B2449DD1DC7}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU
+ {31EB7758-6551-4FEE-A8A0-6B2449DD1DC7}.Release|Mixed Platforms.Build.0 = Release|Any CPU
+ {31EB7758-6551-4FEE-A8A0-6B2449DD1DC7}.Release|x86.ActiveCfg = Release|Any CPU
{D907451F-6D89-40E0-8F0A-D6968647263C}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{D907451F-6D89-40E0-8F0A-D6968647263C}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {D907451F-6D89-40E0-8F0A-D6968647263C}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU
+ {D907451F-6D89-40E0-8F0A-D6968647263C}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU
+ {D907451F-6D89-40E0-8F0A-D6968647263C}.Debug|x86.ActiveCfg = Debug|Any CPU
{D907451F-6D89-40E0-8F0A-D6968647263C}.Release|Any CPU.ActiveCfg = Release|Any CPU
{D907451F-6D89-40E0-8F0A-D6968647263C}.Release|Any CPU.Build.0 = Release|Any CPU
+ {D907451F-6D89-40E0-8F0A-D6968647263C}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU
+ {D907451F-6D89-40E0-8F0A-D6968647263C}.Release|Mixed Platforms.Build.0 = Release|Any CPU
+ {D907451F-6D89-40E0-8F0A-D6968647263C}.Release|x86.ActiveCfg = Release|Any CPU
{12B87C51-B6A9-42C0-9E82-753FCE1D0EA7}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{12B87C51-B6A9-42C0-9E82-753FCE1D0EA7}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {12B87C51-B6A9-42C0-9E82-753FCE1D0EA7}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU
+ {12B87C51-B6A9-42C0-9E82-753FCE1D0EA7}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU
+ {12B87C51-B6A9-42C0-9E82-753FCE1D0EA7}.Debug|x86.ActiveCfg = Debug|Any CPU
{12B87C51-B6A9-42C0-9E82-753FCE1D0EA7}.Release|Any CPU.ActiveCfg = Release|Any CPU
{12B87C51-B6A9-42C0-9E82-753FCE1D0EA7}.Release|Any CPU.Build.0 = Release|Any CPU
+ {12B87C51-B6A9-42C0-9E82-753FCE1D0EA7}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU
+ {12B87C51-B6A9-42C0-9E82-753FCE1D0EA7}.Release|Mixed Platforms.Build.0 = Release|Any CPU
+ {12B87C51-B6A9-42C0-9E82-753FCE1D0EA7}.Release|x86.ActiveCfg = Release|Any CPU
{C5769DEB-C50A-4AAB-90E5-83FB7DEEBDBD}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{C5769DEB-C50A-4AAB-90E5-83FB7DEEBDBD}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {C5769DEB-C50A-4AAB-90E5-83FB7DEEBDBD}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU
+ {C5769DEB-C50A-4AAB-90E5-83FB7DEEBDBD}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU
+ {C5769DEB-C50A-4AAB-90E5-83FB7DEEBDBD}.Debug|x86.ActiveCfg = Debug|Any CPU
{C5769DEB-C50A-4AAB-90E5-83FB7DEEBDBD}.Release|Any CPU.ActiveCfg = Release|Any CPU
{C5769DEB-C50A-4AAB-90E5-83FB7DEEBDBD}.Release|Any CPU.Build.0 = Release|Any CPU
+ {C5769DEB-C50A-4AAB-90E5-83FB7DEEBDBD}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU
+ {C5769DEB-C50A-4AAB-90E5-83FB7DEEBDBD}.Release|Mixed Platforms.Build.0 = Release|Any CPU
+ {C5769DEB-C50A-4AAB-90E5-83FB7DEEBDBD}.Release|x86.ActiveCfg = Release|Any CPU
+ {DD07185B-00FA-4893-869C-A0E731F2E79F}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {DD07185B-00FA-4893-869C-A0E731F2E79F}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {DD07185B-00FA-4893-869C-A0E731F2E79F}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU
+ {DD07185B-00FA-4893-869C-A0E731F2E79F}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU
+ {DD07185B-00FA-4893-869C-A0E731F2E79F}.Debug|x86.ActiveCfg = Debug|Any CPU
+ {DD07185B-00FA-4893-869C-A0E731F2E79F}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {DD07185B-00FA-4893-869C-A0E731F2E79F}.Release|Any CPU.Build.0 = Release|Any CPU
+ {DD07185B-00FA-4893-869C-A0E731F2E79F}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU
+ {DD07185B-00FA-4893-869C-A0E731F2E79F}.Release|Mixed Platforms.Build.0 = Release|Any CPU
+ {DD07185B-00FA-4893-869C-A0E731F2E79F}.Release|x86.ActiveCfg = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
View
BIN  src/packages/NLog.2.0.0.2000/lib/net20/NLog.dll
Binary file not shown
View
14,286 src/packages/NLog.2.0.0.2000/lib/net20/NLog.xml
14,286 additions, 0 deletions not shown
View
BIN  src/packages/NLog.2.0.0.2000/lib/net35/NLog.dll
Binary file not shown
View
14,403 src/packages/NLog.2.0.0.2000/lib/net35/NLog.xml
14,403 additions, 0 deletions not shown
View
BIN  src/packages/NLog.2.0.0.2000/lib/net40/NLog.dll
Binary file not shown
View
14,353 src/packages/NLog.2.0.0.2000/lib/net40/NLog.xml
14,353 additions, 0 deletions not shown
View
BIN  src/packages/NLog.2.0.0.2000/lib/sl2/NLog.dll
Binary file not shown
View
9,119 src/packages/NLog.2.0.0.2000/lib/sl2/NLog.xml
9,119 additions, 0 deletions not shown
View
BIN  src/packages/NLog.2.0.0.2000/lib/sl3-wp/NLog.dll
Binary file not shown
View
8,978 src/packages/NLog.2.0.0.2000/lib/sl3-wp/NLog.xml
8,978 additions, 0 deletions not shown
View
BIN  src/packages/NLog.2.0.0.2000/lib/sl3/NLog.dll
Binary file not shown
View
9,141 src/packages/NLog.2.0.0.2000/lib/sl3/NLog.xml
9,141 additions, 0 deletions not shown
View
BIN  src/packages/NLog.2.0.0.2000/lib/sl4-windowsphone71/NLog.dll
Binary file not shown
View
9,135 src/packages/NLog.2.0.0.2000/lib/sl4-windowsphone71/NLog.xml
9,135 additions, 0 deletions not shown
View
BIN  src/packages/NLog.2.0.0.2000/lib/sl4/NLog.dll
Binary file not shown
View
9,542 src/packages/NLog.2.0.0.2000/lib/sl4/NLog.xml
9,542 additions, 0 deletions not shown
View
1  src/packages/repositories.config
@@ -2,6 +2,7 @@
<repositories>
<repository path="..\NCron.Integration.Autofac\packages.config" />
<repository path="..\NCron.Integration.log4net\packages.config" />
+ <repository path="..\NCron.Integration.NLog\packages.config" />
<repository path="..\NCron\packages.config" />
<repository path="..\Tests.NCron\packages.config" />
</repositories>
Please sign in to comment.
Something went wrong with that request. Please try again.