Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

Adding teh codez

  • Loading branch information...
commit a94ebf82331c3270a26aa8dc980c21ceaf9f49e2 1 parent 25fcb1d
Rob Reynolds authored

Showing 58 changed files with 2,618 additions and 0 deletions. Show diff stats Hide diff stats

  1. +56 0 LoggingExtensions.Core/LogExtensions.cs.pp
  2. +56 0 LoggingExtensions.Core/LogExtensions.vb.pp
  3. +89 0 LoggingExtensions.Core/Logging/ILog.cs
  4. +55 0 LoggingExtensions.Core/Logging/Log.cs
  5. +54 0 LoggingExtensions.Core/Logging/NullLog.cs
  6. +57 0 LoggingExtensions.Core/LoggingExtensions.Core.csproj
  7. +36 0 LoggingExtensions.Core/Properties/AssemblyInfo.cs
  8. +4 0 LoggingExtensions.Core/ReadMe.txt
  9. +21 0 LoggingExtensions.Core/this.Log.nuspec
  10. +65 0 LoggingExtensions.Moq/LoggingExtensions.Moq.csproj
  11. +100 0 LoggingExtensions.Moq/MockLogger.cs
  12. +36 0 LoggingExtensions.Moq/Properties/AssemblyInfo.cs
  13. +7 0 LoggingExtensions.Moq/ReadMe.txt
  14. +4 0 LoggingExtensions.Moq/packages.config
  15. +22 0 LoggingExtensions.Moq/this.log-Moq.nuspec
  16. +65 0 LoggingExtensions.NLog/LoggingExtensions.NLog.csproj
  17. +74 0 LoggingExtensions.NLog/NLogLog.cs
  18. +36 0 LoggingExtensions.NLog/Properties/AssemblyInfo.cs
  19. +6 0 LoggingExtensions.NLog/ReadMe.txt
  20. +4 0 LoggingExtensions.NLog/packages.config
  21. +22 0 LoggingExtensions.NLog/this.Log-NLog.nuspec
  22. +65 0 LoggingExtensions.RhinoMocks/LoggingExtensions.RhinoMocks.csproj
  23. +107 0 LoggingExtensions.RhinoMocks/MockLogger.cs
  24. +36 0 LoggingExtensions.RhinoMocks/Properties/AssemblyInfo.cs
  25. +7 0 LoggingExtensions.RhinoMocks/ReadMe.txt
  26. +4 0 LoggingExtensions.RhinoMocks/packages.config
  27. +22 0 LoggingExtensions.RhinoMocks/this.log-RhinoMocks.nuspec
  28. +64 0 LoggingExtensions.Tests/LogExtensions.cs
  29. +90 0 LoggingExtensions.Tests/LoggingExtensions.Tests.csproj
  30. +140 0 LoggingExtensions.Tests/Performance/Log4NetPerformanceSpecs.cs
  31. +36 0 LoggingExtensions.Tests/Properties/AssemblyInfo.cs
  32. +66 0 LoggingExtensions.Tests/TinySpec.cs
  33. +9 0 LoggingExtensions.Tests/packages.config
  34. +56 0 LoggingExtensions.log4net.Sample.VB/LogExtensions.vb
  35. +134 0 LoggingExtensions.log4net.Sample.VB/LoggingExtensions.log4net.VB.Sample.vbproj
  36. +35 0 LoggingExtensions.log4net.Sample.VB/My Project/AssemblyInfo.vb
  37. +13 0 LoggingExtensions.log4net.Sample.VB/SampleRun.vb
  38. +13 0 LoggingExtensions.log4net.Sample.VB/SampleRun.vb.pp
  39. +7 0 LoggingExtensions.log4net.Sample.VB/TestClass.vb
  40. +7 0 LoggingExtensions.log4net.Sample.VB/TestClass.vb.pp
  41. +69 0 LoggingExtensions.log4net.Sample.VB/app.config
  42. +6 0 LoggingExtensions.log4net.Sample.VB/packages.config
  43. +25 0 LoggingExtensions.log4net.Sample.VB/this.Log-log4net.Sample.VB.nuspec
  44. +69 0 LoggingExtensions.log4net.Sample/App.config
  45. +56 0 LoggingExtensions.log4net.Sample/LogExtensions.cs
  46. +112 0 LoggingExtensions.log4net.Sample/LoggingExtensions.log4net.Sample.csproj
  47. +36 0 LoggingExtensions.log4net.Sample/Properties/AssemblyInfo.cs
  48. +34 0 LoggingExtensions.log4net.Sample/SampleRun.cs
  49. +34 0 LoggingExtensions.log4net.Sample/SampleRun.cs.pp
  50. +6 0 LoggingExtensions.log4net.Sample/packages.config
  51. +24 0 LoggingExtensions.log4net.Sample/this.Log-log4net.Sample.nuspec
  52. +100 0 LoggingExtensions.log4net/Log4NetLog.cs
  53. +69 0 LoggingExtensions.log4net/LoggingExtensions.log4net.csproj
  54. +36 0 LoggingExtensions.log4net/Properties/AssemblyInfo.cs
  55. +8 0 LoggingExtensions.log4net/ReadMe.txt
  56. +4 0 LoggingExtensions.log4net/packages.config
  57. +22 0 LoggingExtensions.log4net/this.log-log4net.nuspec
  58. +128 0 LoggingExtensions.sln
56 LoggingExtensions.Core/LogExtensions.cs.pp
... ... @@ -0,0 +1,56 @@
  1 +// ==============================================================================
  2 +//
  3 +// RealDimensions Software, LLC - Copyright © 2012 - Present - Released under the Apache 2.0 License
  4 +//
  5 +// Copyright 2007-2008 The Apache Software Foundation.
  6 +//
  7 +// Licensed under the Apache License, Version 2.0 (the "License"); you may not use
  8 +// this file except in compliance with the License. You may obtain a copy of the
  9 +// License at
  10 +//
  11 +// http://www.apache.org/licenses/LICENSE-2.0
  12 +//
  13 +// Unless required by applicable law or agreed to in writing, software distributed
  14 +// under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
  15 +// CONDITIONS OF ANY KIND, either express or implied. See the License for the
  16 +// specific language governing permissions and limitations under the License.
  17 +// ==============================================================================
  18 +
  19 +namespace $rootnamespace$
  20 +{
  21 + using System.Collections.Concurrent;
  22 + using LoggingExtensions.Logging;
  23 +
  24 + /// <summary>
  25 + /// Extensions to help make logging awesome - this should be installed into the root namespace of your application
  26 + /// </summary>
  27 + public static class LogExtensions
  28 + {
  29 + /// <summary>
  30 + /// Concurrent dictionary that ensures only one instance of a logger for a type.
  31 + /// </summary>
  32 + private static readonly ConcurrentDictionary<string, ILog> _dictionary = new ConcurrentDictionary<string, ILog>();
  33 +
  34 + /// <summary>
  35 + /// Gets the logger for <see cref="T"/>.
  36 + /// </summary>
  37 + /// <typeparam name="T"></typeparam>
  38 + /// <param name="type">The type to get the logger for.</param>
  39 + /// <returns>Instance of a logger for the object.</returns>
  40 + public static ILog Log<T>(this T type)
  41 + {
  42 + string objectName = typeof (T).FullName;
  43 + return Log(objectName);
  44 + }
  45 +
  46 + /// <summary>
  47 + /// Gets the logger for the specified object name.
  48 + /// </summary>
  49 + /// <param name="objectName">Either use the fully qualified object name or the short. If used with Log&lt;T&gt;() you must use the fully qualified object name"/></param>
  50 + /// <returns>Instance of a logger for the object.</returns>
  51 + public static ILog Log(this string objectName)
  52 + {
  53 + return _dictionary.GetOrAdd(objectName, LoggingExtensions.Logging.Log.GetLoggerFor);
  54 + }
  55 + }
  56 +}
56 LoggingExtensions.Core/LogExtensions.vb.pp
... ... @@ -0,0 +1,56 @@
  1 +' ==============================================================================
  2 +'
  3 +' RealDimensions Software, LLC - Copyright © 2012 - Present - Released under the Apache 2.0 License
  4 +'
  5 +' Copyright 2007-2008 The Apache Software Foundation.
  6 +'
  7 +' Licensed under the Apache License, Version 2.0 (the "License"); you may not use
  8 +' this file except in compliance with the License. You may obtain a copy of the
  9 +' License at
  10 +'
  11 +' http://www.apache.org/licenses/LICENSE-2.0
  12 +'
  13 +' Unless required by applicable law or agreed to in writing, software distributed
  14 +' under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
  15 +' CONDITIONS OF ANY KIND, either express or implied. See the License for the
  16 +' specific language governing permissions and limitations under the License.
  17 +' ==============================================================================
  18 +
  19 +Imports System.Collections.Concurrent
  20 +Imports System.Runtime.CompilerServices
  21 +Imports LoggingExtensions.Logging
  22 +
  23 +''' <summary>
  24 +''' Extensions to help make logging awesome - this should be installed into the root namespace of your application
  25 +''' </summary>
  26 +Public Module LogExtensions
  27 +
  28 + ''' <summary>
  29 + ''' Concurrent dictionary that ensures only one instance of a logger for a type.
  30 + ''' </summary>
  31 + Private ReadOnly _dictionary As ConcurrentDictionary(Of String, ILog) = New ConcurrentDictionary(Of String, ILog)
  32 +
  33 + ''' <summary>
  34 + ''' Gets the logger for <see cref="T"/>.
  35 + ''' </summary>
  36 + ''' <typeparam name="T"></typeparam>
  37 + ''' <param name="type">The type to get the logger for.</param>
  38 + ''' <returns>Instance of a logger for the object.</returns>
  39 + <Extension()>
  40 + Public Function Log(Of T)(type As T) As ILog
  41 + Dim objectName As String = GetType(T).FullName
  42 +
  43 + Return Log(objectName)
  44 + End Function
  45 +
  46 + ''' <summary>
  47 + ''' Gets the logger for the specified object name.
  48 + ''' </summary>
  49 + ''' <param name="objectName">Either use the fully qualified object name or the short. If used with Log&lt;T&gt;() you must use the fully qualified object name"/></param>
  50 + ''' <returns>Instance of a logger for the object.</returns>
  51 + <Extension()>
  52 + Public Function Log(objectName As String) As ILog
  53 + Return _dictionary.GetOrAdd(objectName, Function(name) (LoggingExtensions.Logging.Log.GetLoggerFor(name)))
  54 + End Function
  55 +
  56 +End Module
89 LoggingExtensions.Core/Logging/ILog.cs
... ... @@ -0,0 +1,89 @@
  1 +namespace LoggingExtensions.Logging
  2 +{
  3 + using System;
  4 +
  5 + /// <summary>
  6 + /// Custom interface for logging messages
  7 + /// </summary>
  8 + public interface ILog
  9 + {
  10 + /// <summary>
  11 + /// Initializes the instance for the logger name
  12 + /// </summary>
  13 + /// <param name="loggerName">Name of the logger</param>
  14 + void InitializeFor(string loggerName);
  15 +
  16 + /// <summary>
  17 + /// Debug level of the specified message. The other method is preferred since the execution is deferred.
  18 + /// </summary>
  19 + /// <param name="message">The message.</param>
  20 + /// <param name="formatting">The formatting.</param>
  21 + void Debug(string message, params object[] formatting);
  22 +
  23 + /// <summary>
  24 + /// Debug level of the specified message.
  25 + /// </summary>
  26 + /// <param name="message">The message.</param>
  27 + void Debug(Func<string> message);
  28 +
  29 + /// <summary>
  30 + /// Info level of the specified message. The other method is preferred since the execution is deferred.
  31 + /// </summary>
  32 + /// <param name="message">The message.</param>
  33 + /// <param name="formatting">The formatting.</param>
  34 + void Info(string message, params object[] formatting);
  35 +
  36 + /// <summary>
  37 + /// Info level of the specified message.
  38 + /// </summary>
  39 + /// <param name="message">The message.</param>
  40 + void Info(Func<string> message);
  41 +
  42 + /// <summary>
  43 + /// Warn level of the specified message. The other method is preferred since the execution is deferred.
  44 + /// </summary>
  45 + /// <param name="message">The message.</param>
  46 + /// <param name="formatting">The formatting.</param>
  47 + void Warn(string message, params object[] formatting);
  48 +
  49 + /// <summary>
  50 + /// Warn level of the specified message.
  51 + /// </summary>
  52 + /// <param name="message">The message.</param>
  53 + void Warn(Func<string> message);
  54 +
  55 + /// <summary>
  56 + /// Error level of the specified message. The other method is preferred since the execution is deferred.
  57 + /// </summary>
  58 + /// <param name="message">The message.</param>
  59 + /// <param name="formatting">The formatting.</param>
  60 + void Error(string message, params object[] formatting);
  61 +
  62 + /// <summary>
  63 + /// Error level of the specified message.
  64 + /// </summary>
  65 + /// <param name="message">The message.</param>
  66 + void Error(Func<string> message);
  67 +
  68 + /// <summary>
  69 + /// Fatal level of the specified message. The other method is preferred since the execution is deferred.
  70 + /// </summary>
  71 + /// <param name="message">The message.</param>
  72 + /// <param name="formatting">The formatting.</param>
  73 + void Fatal(string message, params object[] formatting);
  74 +
  75 + /// <summary>
  76 + /// Fatal level of the specified message.
  77 + /// </summary>
  78 + /// <param name="message">The message.</param>
  79 + void Fatal(Func<string> message);
  80 + }
  81 +
  82 + /// <summary>
  83 + /// Ensures a default constructor for the logger type
  84 + /// </summary>
  85 + /// <typeparam name="T"></typeparam>
  86 + public interface ILog<T> //where T : new()
  87 + {
  88 + }
  89 +}
55 LoggingExtensions.Core/Logging/Log.cs
... ... @@ -0,0 +1,55 @@
  1 +namespace LoggingExtensions.Logging
  2 +{
  3 + using System;
  4 + using System.Collections.Concurrent;
  5 + using System.ComponentModel;
  6 +
  7 + /// <summary>
  8 + /// Logger type initialization
  9 + /// </summary>
  10 + public static class Log
  11 + {
  12 + private static Type _logType = typeof(NullLog);
  13 + private static ILog _testLogger;
  14 +
  15 + /// <summary>
  16 + /// Sets up logging to be with a certain type
  17 + /// </summary>
  18 + /// <typeparam name="T">The type of ILog for the application to use</typeparam>
  19 + public static void InitializeWith<T>() where T : ILog, new()
  20 + {
  21 + _logType = typeof(T);
  22 + }
  23 +
  24 + /// <summary>
  25 + /// Sets up logging to be with a certain instance. The other method is preferred.
  26 + /// </summary>
  27 + /// <param name="testLoggerType">Type of the logger.</param>
  28 + /// <remarks>This is mostly geared towards testing</remarks>
  29 + [EditorBrowsable(EditorBrowsableState.Never)]
  30 + public static void InitializeWith(ILog testLoggerType)
  31 + {
  32 + _logType = testLoggerType.GetType();
  33 + _testLogger = testLoggerType;
  34 + }
  35 +
  36 + /// <summary>
  37 + /// Initializes a new instance of a logger for an object.
  38 + /// This should be done only once per object name.
  39 + /// </summary>
  40 + /// <param name="objectName">Name of the object.</param>
  41 + /// <returns>ILog instance for an object if log type has been intialized; otherwise null</returns>
  42 + public static ILog GetLoggerFor(string objectName)
  43 + {
  44 + if (_testLogger != null) return _testLogger;
  45 +
  46 + var logger = Activator.CreateInstance(_logType) as ILog;
  47 + if (logger != null)
  48 + {
  49 + logger.InitializeFor(objectName);
  50 + }
  51 +
  52 + return logger;
  53 + }
  54 + }
  55 +}
54 LoggingExtensions.Core/Logging/NullLog.cs
... ... @@ -0,0 +1,54 @@
  1 +namespace LoggingExtensions.Logging
  2 +{
  3 + using System;
  4 +
  5 + /// <summary>
  6 + /// The default logger until one is set.
  7 + /// </summary>
  8 + public class NullLog : ILog, ILog<NullLog>
  9 + {
  10 + public void InitializeFor(string loggerName)
  11 + {
  12 + }
  13 +
  14 + public void Debug(string message, params object[] formatting)
  15 + {
  16 + }
  17 +
  18 + public void Debug(Func<string> message)
  19 + {
  20 + }
  21 +
  22 + public void Info(string message, params object[] formatting)
  23 + {
  24 + }
  25 +
  26 + public void Info(Func<string> message)
  27 + {
  28 + }
  29 +
  30 + public void Warn(string message, params object[] formatting)
  31 + {
  32 + }
  33 +
  34 + public void Warn(Func<string> message)
  35 + {
  36 + }
  37 +
  38 + public void Error(string message, params object[] formatting)
  39 + {
  40 + }
  41 +
  42 + public void Error(Func<string> message)
  43 + {
  44 + }
  45 +
  46 + public void Fatal(string message, params object[] formatting)
  47 + {
  48 + }
  49 +
  50 + public void Fatal(Func<string> message)
  51 + {
  52 + }
  53 + }
  54 +}
57 LoggingExtensions.Core/LoggingExtensions.Core.csproj
... ... @@ -0,0 +1,57 @@
  1 +<?xml version="1.0" encoding="utf-8"?>
  2 +<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
  3 + <PropertyGroup>
  4 + <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
  5 + <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
  6 + <ProductVersion>8.0.30703</ProductVersion>
  7 + <SchemaVersion>2.0</SchemaVersion>
  8 + <ProjectGuid>{F61EB8DD-2E99-4E3B-96F0-8015FC6FB880}</ProjectGuid>
  9 + <OutputType>Library</OutputType>
  10 + <AppDesignerFolder>Properties</AppDesignerFolder>
  11 + <RootNamespace>LoggingExtensions</RootNamespace>
  12 + <AssemblyName>this.Log</AssemblyName>
  13 + <TargetFrameworkVersion>v4.0</TargetFrameworkVersion>
  14 + <FileAlignment>512</FileAlignment>
  15 + </PropertyGroup>
  16 + <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
  17 + <DebugSymbols>true</DebugSymbols>
  18 + <DebugType>full</DebugType>
  19 + <Optimize>false</Optimize>
  20 + <OutputPath>bin\Debug\</OutputPath>
  21 + <DefineConstants>DEBUG;TRACE</DefineConstants>
  22 + <ErrorReport>prompt</ErrorReport>
  23 + <WarningLevel>4</WarningLevel>
  24 + </PropertyGroup>
  25 + <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
  26 + <DebugType>pdbonly</DebugType>
  27 + <Optimize>true</Optimize>
  28 + <OutputPath>bin\Release\</OutputPath>
  29 + <DefineConstants>TRACE</DefineConstants>
  30 + <ErrorReport>prompt</ErrorReport>
  31 + <WarningLevel>4</WarningLevel>
  32 + </PropertyGroup>
  33 + <ItemGroup>
  34 + <Reference Include="System" />
  35 + <Reference Include="System.Core" />
  36 + </ItemGroup>
  37 + <ItemGroup>
  38 + <Compile Include="Logging\ILog.cs" />
  39 + <Compile Include="Logging\Log.cs" />
  40 + <Content Include="ReadMe.txt" />
  41 + <Content Include="LogExtensions.cs.pp" />
  42 + <Compile Include="Logging\NullLog.cs" />
  43 + <Compile Include="Properties\AssemblyInfo.cs" />
  44 + </ItemGroup>
  45 + <ItemGroup>
  46 + <None Include="LogExtensions.vb.pp" />
  47 + <None Include="this.Log.nuspec" />
  48 + </ItemGroup>
  49 + <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
  50 + <!-- To modify your build process, add your task inside one of the targets below and uncomment it.
  51 + Other similar extension points exist, see Microsoft.Common.targets.
  52 + <Target Name="BeforeBuild">
  53 + </Target>
  54 + <Target Name="AfterBuild">
  55 + </Target>
  56 + -->
  57 +</Project>
36 LoggingExtensions.Core/Properties/AssemblyInfo.cs
... ... @@ -0,0 +1,36 @@
  1 +using System.Reflection;
  2 +using System.Runtime.CompilerServices;
  3 +using System.Runtime.InteropServices;
  4 +
  5 +// General Information about an assembly is controlled through the following
  6 +// set of attributes. Change these attribute values to modify the information
  7 +// associated with an assembly.
  8 +[assembly: AssemblyTitle("this.Log Logging Extension")]
  9 +[assembly: AssemblyDescription("")]
  10 +[assembly: AssemblyConfiguration("")]
  11 +[assembly: AssemblyCompany("RealDimensions Software, LLC")]
  12 +[assembly: AssemblyProduct("this.Log")]
  13 +[assembly: AssemblyCopyright("Copyright © 2012 RealDimensions Software, LLC")]
  14 +[assembly: AssemblyTrademark("")]
  15 +[assembly: AssemblyCulture("")]
  16 +
  17 +// Setting ComVisible to false makes the types in this assembly not visible
  18 +// to COM components. If you need to access a type in this assembly from
  19 +// COM, set the ComVisible attribute to true on that type.
  20 +[assembly: ComVisible(false)]
  21 +
  22 +// The following GUID is for the ID of the typelib if this project is exposed to COM
  23 +[assembly: Guid("bfbc3bef-c6e7-4dfd-92ed-2fa2ab6335ef")]
  24 +
  25 +// Version information for an assembly consists of the following four values:
  26 +//
  27 +// Major Version
  28 +// Minor Version
  29 +// Build Number
  30 +// Revision
  31 +//
  32 +// You can specify all the values or you can default the Build and Revision Numbers
  33 +// by using the '*' as shown below:
  34 +// [assembly: AssemblyVersion("1.0.*")]
  35 +[assembly: AssemblyVersion("0.0.1.0")]
  36 +[assembly: AssemblyFileVersion("0.0.1.0")]
4 LoggingExtensions.Core/ReadMe.txt
... ... @@ -0,0 +1,4 @@
  1 +this.Log
  2 +========
  3 +
  4 +This is the core package and doesn't implement a logging facility. You will want to install one of the ancillary packages for it to start logging.
21 LoggingExtensions.Core/this.Log.nuspec
... ... @@ -0,0 +1,21 @@
  1 +<?xml version="1.0"?>
  2 +<package >
  3 + <metadata>
  4 + <id>$id$</id>
  5 + <version>$version$</version>
  6 + <title>$title$</title>
  7 + <authors>$author$</authors>
  8 + <owners>Rob Reynolds</owners>
  9 + <projectUrl>https://github.com/ferventcoder/this.Log</projectUrl>
  10 + <licenseUrl>https://raw.github.com/ferventcoder/this.Log/master/LICENSE</licenseUrl>
  11 + <requireLicenseAcceptance>false</requireLicenseAcceptance>
  12 + <summary>this.Log - Logging Extensions that work in all code locations</summary>
  13 + <description>this.Log is a Logging Extension that works in all code locations.
  14 +This package by itself only brings the logging extension and allows you to call this.Log().Debug, etc.
  15 +What it doesn't bring though is a logging facility. Please search nuget for this.Log to see the facilities.
  16 + </description>
  17 + <releaseNotes></releaseNotes>
  18 + <copyright>Copyright 2012</copyright>
  19 + <tags>logging log this.Log</tags>
  20 + </metadata>
  21 +</package>
65 LoggingExtensions.Moq/LoggingExtensions.Moq.csproj
... ... @@ -0,0 +1,65 @@
  1 +<?xml version="1.0" encoding="utf-8"?>
  2 +<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
  3 + <PropertyGroup>
  4 + <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
  5 + <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
  6 + <ProductVersion>8.0.30703</ProductVersion>
  7 + <SchemaVersion>2.0</SchemaVersion>
  8 + <ProjectGuid>{00127809-D90C-470E-8729-DF5D66695A6D}</ProjectGuid>
  9 + <OutputType>Library</OutputType>
  10 + <AppDesignerFolder>Properties</AppDesignerFolder>
  11 + <RootNamespace>LoggingExtensions.Moq</RootNamespace>
  12 + <AssemblyName>this.log-moq</AssemblyName>
  13 + <TargetFrameworkVersion>v4.0</TargetFrameworkVersion>
  14 + <FileAlignment>512</FileAlignment>
  15 + </PropertyGroup>
  16 + <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
  17 + <DebugSymbols>true</DebugSymbols>
  18 + <DebugType>full</DebugType>
  19 + <Optimize>false</Optimize>
  20 + <OutputPath>bin\Debug\</OutputPath>
  21 + <DefineConstants>DEBUG;TRACE</DefineConstants>
  22 + <ErrorReport>prompt</ErrorReport>
  23 + <WarningLevel>4</WarningLevel>
  24 + </PropertyGroup>
  25 + <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
  26 + <DebugType>pdbonly</DebugType>
  27 + <Optimize>true</Optimize>
  28 + <OutputPath>bin\Release\</OutputPath>
  29 + <DefineConstants>TRACE</DefineConstants>
  30 + <ErrorReport>prompt</ErrorReport>
  31 + <WarningLevel>4</WarningLevel>
  32 + </PropertyGroup>
  33 + <ItemGroup>
  34 + <Reference Include="Moq">
  35 + <HintPath>..\packages\Moq.4.0.10827\lib\NET40\Moq.dll</HintPath>
  36 + </Reference>
  37 + <Reference Include="System" />
  38 + <Reference Include="System.Core" />
  39 + </ItemGroup>
  40 + <ItemGroup>
  41 + <Compile Include="MockLogger.cs" />
  42 + <Compile Include="Properties\AssemblyInfo.cs" />
  43 + </ItemGroup>
  44 + <ItemGroup>
  45 + <ProjectReference Include="..\LoggingExtensions.Core\LoggingExtensions.Core.csproj">
  46 + <Project>{F61EB8DD-2E99-4E3B-96F0-8015FC6FB880}</Project>
  47 + <Name>LoggingExtensions.Core</Name>
  48 + </ProjectReference>
  49 + </ItemGroup>
  50 + <ItemGroup>
  51 + <None Include="packages.config" />
  52 + <None Include="this.log-Moq.nuspec" />
  53 + </ItemGroup>
  54 + <ItemGroup>
  55 + <Content Include="ReadMe.txt" />
  56 + </ItemGroup>
  57 + <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
  58 + <!-- To modify your build process, add your task inside one of the targets below and uncomment it.
  59 + Other similar extension points exist, see Microsoft.Common.targets.
  60 + <Target Name="BeforeBuild">
  61 + </Target>
  62 + <Target Name="AfterBuild">
  63 + </Target>
  64 + -->
  65 +</Project>
100 LoggingExtensions.Moq/MockLogger.cs
... ... @@ -0,0 +1,100 @@
  1 +namespace LoggingExtensions.Moq
  2 +{
  3 + using System;
  4 + using System.Collections.Concurrent;
  5 + using System.Collections.Generic;
  6 + using Logging;
  7 + using global::Moq;
  8 +
  9 + public enum LogLevel
  10 + {
  11 + Debug,
  12 + Info,
  13 + Warn,
  14 + Error,
  15 + Fatal
  16 + }
  17 +
  18 + public class MockLogger : Mock<ILog>, ILog, ILog<MockLogger>
  19 + {
  20 + private readonly Lazy<ConcurrentDictionary<string, IList<string>>> _messages = new Lazy<ConcurrentDictionary<string, IList<string>>>();
  21 +
  22 + public ConcurrentDictionary<string, IList<string>> Messages
  23 + {
  24 + get { return _messages.Value; }
  25 + }
  26 +
  27 + public IList<string> MessagesFor(LogLevel logLevel)
  28 + {
  29 + return _messages.Value.GetOrAdd(logLevel.ToString(), new List<string>());
  30 + }
  31 +
  32 + public void InitializeFor(string loggerName) {}
  33 +
  34 + public void LogMessage(LogLevel logLevel, string message)
  35 + {
  36 + var list = _messages.Value.GetOrAdd(logLevel.ToString(), new List<string>());
  37 + list.Add(message);
  38 + }
  39 +
  40 + public void Debug(string message, params object[] formatting)
  41 + {
  42 + LogMessage(LogLevel.Debug, string.Format(message,formatting));
  43 + Object.Debug(message, formatting);
  44 + }
  45 +
  46 + public void Debug(Func<string> message)
  47 + {
  48 + LogMessage(LogLevel.Debug, message());
  49 + Object.Debug(message);
  50 + }
  51 +
  52 + public void Info(string message, params object[] formatting)
  53 + {
  54 + LogMessage(LogLevel.Info, string.Format(message, formatting));
  55 + Object.Info(message, formatting);
  56 + }
  57 +
  58 + public void Info(Func<string> message)
  59 + {
  60 + LogMessage(LogLevel.Info, message());
  61 + Object.Info(message);
  62 + }
  63 +
  64 + public void Warn(string message, params object[] formatting)
  65 + {
  66 + LogMessage(LogLevel.Warn, string.Format(message, formatting));
  67 + Object.Warn(message, formatting);
  68 + }
  69 +
  70 + public void Warn(Func<string> message)
  71 + {
  72 + LogMessage(LogLevel.Warn, message());
  73 + Object.Warn(message);
  74 + }
  75 +
  76 + public void Error(string message, params object[] formatting)
  77 + {
  78 + LogMessage(LogLevel.Error, string.Format(message, formatting));
  79 + Object.Error(message, formatting);
  80 + }
  81 +
  82 + public void Error(Func<string> message)
  83 + {
  84 + LogMessage(LogLevel.Error, message());
  85 + Object.Error(message);
  86 + }
  87 +
  88 + public void Fatal(string message, params object[] formatting)
  89 + {
  90 + LogMessage(LogLevel.Fatal, string.Format(message, formatting));
  91 + Object.Fatal(message, formatting);
  92 + }
  93 +
  94 + public void Fatal(Func<string> message)
  95 + {
  96 + LogMessage(LogLevel.Fatal, message());
  97 + Object.Fatal(message);
  98 + }
  99 + }
  100 +}
36 LoggingExtensions.Moq/Properties/AssemblyInfo.cs
... ... @@ -0,0 +1,36 @@
  1 +using System.Reflection;
  2 +using System.Runtime.CompilerServices;
  3 +using System.Runtime.InteropServices;
  4 +
  5 +// General Information about an assembly is controlled through the following
  6 +// set of attributes. Change these attribute values to modify the information
  7 +// associated with an assembly.
  8 +[assembly: AssemblyTitle("this.Log Logging Extension (Moq Plugin)")]
  9 +[assembly: AssemblyDescription("")]
  10 +[assembly: AssemblyConfiguration("")]
  11 +[assembly: AssemblyCompany("RealDimensions Software, LLC")]
  12 +[assembly: AssemblyProduct("this.Log-Moq")]
  13 +[assembly: AssemblyCopyright("Copyright © 2012 RealDimensions Software, LLC")]
  14 +[assembly: AssemblyTrademark("")]
  15 +[assembly: AssemblyCulture("")]
  16 +
  17 +// Setting ComVisible to false makes the types in this assembly not visible
  18 +// to COM components. If you need to access a type in this assembly from
  19 +// COM, set the ComVisible attribute to true on that type.
  20 +[assembly: ComVisible(false)]
  21 +
  22 +// The following GUID is for the ID of the typelib if this project is exposed to COM
  23 +[assembly: Guid("4ca2ae68-adcc-4924-b1b5-925febe1637e")]
  24 +
  25 +// Version information for an assembly consists of the following four values:
  26 +//
  27 +// Major Version
  28 +// Minor Version
  29 +// Build Number
  30 +// Revision
  31 +//
  32 +// You can specify all the values or you can default the Build and Revision Numbers
  33 +// by using the '*' as shown below:
  34 +// [assembly: AssemblyVersion("1.0.*")]
  35 +[assembly: AssemblyVersion("0.0.1.0")]
  36 +[assembly: AssemblyFileVersion("0.0.1.0")]
7 LoggingExtensions.Moq/ReadMe.txt
... ... @@ -0,0 +1,7 @@
  1 +this.Log-Moq
  2 +============
  3 +
  4 +In your application startup, please include these lines:
  5 +
  6 +Logger = new LoggingExtensions.Moq.MockLogger();
  7 +LoggingExtensions.Logging.Log.InitializeWith(Logger);
4 LoggingExtensions.Moq/packages.config
... ... @@ -0,0 +1,4 @@
  1 +<?xml version="1.0" encoding="utf-8"?>
  2 +<packages>
  3 + <package id="Moq" version="4.0.10827" targetFramework="net40" />
  4 +</packages>
22 LoggingExtensions.Moq/this.log-Moq.nuspec
... ... @@ -0,0 +1,22 @@
  1 +<?xml version="1.0"?>
  2 +<package >
  3 + <metadata>
  4 + <id>$id$</id>
  5 + <version>$version$</version>
  6 + <title>$title$</title>
  7 + <authors>$author$</authors>
  8 + <owners>Rob Reynolds</owners>
  9 + <projectUrl>https://github.com/ferventcoder/this.Log</projectUrl>
  10 + <licenseUrl>https://raw.github.com/ferventcoder/this.Log/master/LICENSE</licenseUrl>
  11 + <requireLicenseAcceptance>false</requireLicenseAcceptance>
  12 + <summary>this.Log-Moq - this.Log logging extension using Moq</summary>
  13 + <description>this.Log-Moq is the Moq plugin to this.Log logging extension that brings the MockLogger.</description>
  14 + <releaseNotes></releaseNotes>
  15 + <copyright>Copyright 2012</copyright>
  16 + <tags>logging log this.Log testing moq</tags>
  17 + <dependencies>
  18 + <dependency id="this.Log" version="0.0.1.0" />
  19 + <dependency id="Moq" version="4.0.10827" />
  20 + </dependencies>
  21 + </metadata>
  22 +</package>
65 LoggingExtensions.NLog/LoggingExtensions.NLog.csproj
... ... @@ -0,0 +1,65 @@
  1 +<?xml version="1.0" encoding="utf-8"?>
  2 +<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
  3 + <PropertyGroup>
  4 + <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
  5 + <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
  6 + <ProductVersion>8.0.30703</ProductVersion>
  7 + <SchemaVersion>2.0</SchemaVersion>
  8 + <ProjectGuid>{E045C968-1B32-493F-A3C1-B428A2789F44}</ProjectGuid>
  9 + <OutputType>Library</OutputType>
  10 + <AppDesignerFolder>Properties</AppDesignerFolder>
  11 + <RootNamespace>LoggingExtensions.NLog</RootNamespace>
  12 + <AssemblyName>this.Log-NLog</AssemblyName>
  13 + <TargetFrameworkVersion>v4.0</TargetFrameworkVersion>
  14 + <FileAlignment>512</FileAlignment>
  15 + </PropertyGroup>
  16 + <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
  17 + <DebugSymbols>true</DebugSymbols>
  18 + <DebugType>full</DebugType>
  19 + <Optimize>false</Optimize>
  20 + <OutputPath>bin\Debug\</OutputPath>
  21 + <DefineConstants>DEBUG;TRACE</DefineConstants>
  22 + <ErrorReport>prompt</ErrorReport>
  23 + <WarningLevel>4</WarningLevel>
  24 + </PropertyGroup>
  25 + <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
  26 + <DebugType>pdbonly</DebugType>
  27 + <Optimize>true</Optimize>
  28 + <OutputPath>bin\Release\</OutputPath>
  29 + <DefineConstants>TRACE</DefineConstants>
  30 + <ErrorReport>prompt</ErrorReport>
  31 + <WarningLevel>4</WarningLevel>
  32 + </PropertyGroup>
  33 + <ItemGroup>
  34 + <Reference Include="NLog">
  35 + <HintPath>..\packages\NLog.2.0.0.2000\lib\net40\NLog.dll</HintPath>
  36 + </Reference>
  37 + <Reference Include="System" />
  38 + <Reference Include="System.Core" />
  39 + </ItemGroup>
  40 + <ItemGroup>
  41 + <Compile Include="NLogLog.cs" />
  42 + <Compile Include="Properties\AssemblyInfo.cs" />
  43 + </ItemGroup>
  44 + <ItemGroup>
  45 + <None Include="packages.config" />
  46 + <None Include="this.Log-NLog.nuspec" />
  47 + </ItemGroup>
  48 + <ItemGroup>
  49 + <ProjectReference Include="..\LoggingExtensions.Core\LoggingExtensions.Core.csproj">
  50 + <Project>{F61EB8DD-2E99-4E3B-96F0-8015FC6FB880}</Project>
  51 + <Name>LoggingExtensions.Core</Name>
  52 + </ProjectReference>
  53 + </ItemGroup>
  54 + <ItemGroup>
  55 + <Content Include="ReadMe.txt" />
  56 + </ItemGroup>
  57 + <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
  58 + <!-- To modify your build process, add your task inside one of the targets below and uncomment it.
  59 + Other similar extension points exist, see Microsoft.Common.targets.
  60 + <Target Name="BeforeBuild">
  61 + </Target>
  62 + <Target Name="AfterBuild">
  63 + </Target>
  64 + -->
  65 +</Project>
74 LoggingExtensions.NLog/NLogLog.cs
... ... @@ -0,0 +1,74 @@
  1 +namespace LoggingExtensions.NLog
  2 +{
  3 + using System;
  4 + using Logging;
  5 + using LoggingExtensions;
  6 + using global::NLog;
  7 +
  8 + /// <summary>
  9 + /// Log4net logger implementing special ILog class
  10 + /// </summary>
  11 + public class NLogLog : ILog, ILog<NLogLog>
  12 + {
  13 + private Logger _logger;
  14 +
  15 + public void InitializeFor(string loggerName)
  16 + {
  17 + _logger = LogManager.GetLogger(loggerName);
  18 + }
  19 +
  20 + public void Debug(string message, params object[] formatting)
  21 + {
  22 + if (_logger.IsDebugEnabled) _logger.Debug(message, formatting);
  23 + }
  24 +
  25 + public void Debug(Func<string> message)
  26 + {
  27 + if (_logger.IsDebugEnabled) _logger.Debug(message());
  28 + }
  29 +
  30 + public void Info(string message, params object[] formatting)
  31 + {
  32 + if (_logger.IsInfoEnabled) _logger.Info(message, formatting);
  33 + }
  34 +
  35 + public void Info(Func<string> message)
  36 + {
  37 + if (_logger.IsInfoEnabled) _logger.Info(message());
  38 + }
  39 +
  40 + public void Warn(string message, params object[] formatting)
  41 + {
  42 + if (_logger.IsWarnEnabled) _logger.Warn(message, formatting);
  43 + }
  44 +
  45 + public void Warn(Func<string> message)
  46 + {
  47 + if (_logger.IsWarnEnabled) _logger.Warn(message());
  48 + }
  49 +
  50 + public void Error(string message, params object[] formatting)
  51 + {
  52 + // don't check for enabled at this level
  53 + _logger.Error(message, formatting);
  54 + }
  55 +
  56 + public void Error(Func<string> message)
  57 + {
  58 + // don't check for enabled at this level
  59 + _logger.Error(message());
  60 + }
  61 +
  62 + public void Fatal(string message, params object[] formatting)
  63 + {
  64 + // don't check for enabled at this level
  65 + _logger.Fatal(message, formatting);
  66 + }
  67 +
  68 + public void Fatal(Func<string> message)
  69 + {
  70 + // don't check for enabled at this level
  71 + _logger.Fatal(message());
  72 + }
  73 + }
  74 +}
36 LoggingExtensions.NLog/Properties/AssemblyInfo.cs
... ... @@ -0,0 +1,36 @@
  1 +using System.Reflection;
  2 +using System.Runtime.CompilerServices;
  3 +using System.Runtime.InteropServices;
  4 +
  5 +// General Information about an assembly is controlled through the following
  6 +// set of attributes. Change these attribute values to modify the information
  7 +// associated with an assembly.
  8 +[assembly: AssemblyTitle("this.Log Logging Extension (NLog Plugin)")]
  9 +[assembly: AssemblyDescription("")]
  10 +[assembly: AssemblyConfiguration("")]
  11 +[assembly: AssemblyCompany("RealDimensions Software, LLC")]
  12 +[assembly: AssemblyProduct("this.Log-NLog")]
  13 +[assembly: AssemblyCopyright("Copyright © 2012 RealDimensions Software, LLC")]
  14 +[assembly: AssemblyTrademark("")]
  15 +[assembly: AssemblyCulture("")]
  16 +
  17 +// Setting ComVisible to false makes the types in this assembly not visible
  18 +// to COM components. If you need to access a type in this assembly from
  19 +// COM, set the ComVisible attribute to true on that type.
  20 +[assembly: ComVisible(false)]
  21 +
  22 +// The following GUID is for the ID of the typelib if this project is exposed to COM
  23 +[assembly: Guid("c0c7f4f5-2ee7-45ee-a1c3-25de40fbc64a")]
  24 +
  25 +// Version information for an assembly consists of the following four values:
  26 +//
  27 +// Major Version
  28 +// Minor Version
  29 +// Build Number
  30 +// Revision
  31 +//
  32 +// You can specify all the values or you can default the Build and Revision Numbers
  33 +// by using the '*' as shown below:
  34 +// [assembly: AssemblyVersion("1.0.*")]
  35 +[assembly: AssemblyVersion("0.0.1.0")]
  36 +[assembly: AssemblyFileVersion("0.0.1.0")]
6 LoggingExtensions.NLog/ReadMe.txt
... ... @@ -0,0 +1,6 @@
  1 +this.Log-NLog
  2 +=============
  3 +
  4 +In your application startup, please include this line:
  5 +
  6 +Log.InitializeWith<NLogLog>();
4 LoggingExtensions.NLog/packages.config
... ... @@ -0,0 +1,4 @@
  1 +<?xml version="1.0" encoding="utf-8"?>
  2 +<packages>
  3 + <package id="NLog" version="2.0.0.2000" targetFramework="net40" />
  4 +</packages>
22 LoggingExtensions.NLog/this.Log-NLog.nuspec
... ... @@ -0,0 +1,22 @@
  1 +<?xml version="1.0"?>
  2 +<package >
  3 + <metadata>
  4 + <id>$id$</id>
  5 + <version>$version$</version>
  6 + <title>$title$</title>
  7 + <authors>$author$</authors>
  8 + <owners>Rob Reynolds</owners>
  9 + <projectUrl>https://github.com/ferventcoder/this.Log</projectUrl>
  10 + <licenseUrl>https://raw.github.com/ferventcoder/this.Log/master/LICENSE</licenseUrl>
  11 + <requireLicenseAcceptance>false</requireLicenseAcceptance>
  12 + <summary>this.Log-NLog - this.Log logging extension using NLog</summary>
  13 + <description>this.Log-NLog</description>
  14 + <releaseNotes></releaseNotes>
  15 + <copyright>Copyright 2012</copyright>
  16 + <tags>logging log this.Log nlog</tags>
  17 + <dependencies>
  18 + <dependency id="this.Log" version="0.0.1.0" />
  19 + <dependency id="NLog" version="2.0.0.2000" />
  20 + </dependencies>
  21 + </metadata>
  22 +</package>
65 LoggingExtensions.RhinoMocks/LoggingExtensions.RhinoMocks.csproj
... ... @@ -0,0 +1,65 @@
  1 +<?xml version="1.0" encoding="utf-8"?>
  2 +<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
  3 + <PropertyGroup>
  4 + <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
  5 + <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
  6 + <ProductVersion>8.0.30703</ProductVersion>
  7 + <SchemaVersion>2.0</SchemaVersion>
  8 + <ProjectGuid>{E7D6D2FF-254B-4720-BEC5-E45305621A0D}</ProjectGuid>
  9 + <OutputType>Library</OutputType>
  10 + <AppDesignerFolder>Properties</AppDesignerFolder>
  11 + <RootNamespace>LoggingExtensions.RhinoMocks</RootNamespace>
  12 + <AssemblyName>this.Log-RhinoMocks</AssemblyName>
  13 + <TargetFrameworkVersion>v4.0</TargetFrameworkVersion>
  14 + <FileAlignment>512</FileAlignment>
  15 + </PropertyGroup>
  16 + <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
  17 + <DebugSymbols>true</DebugSymbols>
  18 + <DebugType>full</DebugType>
  19 + <Optimize>false</Optimize>
  20 + <OutputPath>bin\Debug\</OutputPath>
  21 + <DefineConstants>DEBUG;TRACE</DefineConstants>
  22 + <ErrorReport>prompt</ErrorReport>
  23 + <WarningLevel>4</WarningLevel>
  24 + </PropertyGroup>
  25 + <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
  26 + <DebugType>pdbonly</DebugType>
  27 + <Optimize>true</Optimize>
  28 + <OutputPath>bin\Release\</OutputPath>
  29 + <DefineConstants>TRACE</DefineConstants>
  30 + <ErrorReport>prompt</ErrorReport>
  31 + <WarningLevel>4</WarningLevel>
  32 + </PropertyGroup>
  33 + <ItemGroup>
  34 + <Reference Include="Rhino.Mocks">
  35 + <HintPath>..\packages\RhinoMocks.3.6.1\lib\net\Rhino.Mocks.dll</HintPath>
  36 + </Reference>
  37 + <Reference Include="System" />
  38 + <Reference Include="System.Core" />
  39 + </ItemGroup>
  40 + <ItemGroup>
  41 + <Compile Include="MockLogger.cs" />
  42 + <Compile Include="Properties\AssemblyInfo.cs" />
  43 + </ItemGroup>
  44 + <ItemGroup>
  45 + <ProjectReference Include="..\LoggingExtensions.Core\LoggingExtensions.Core.csproj">
  46 + <Project>{F61EB8DD-2E99-4E3B-96F0-8015FC6FB880}</Project>
  47 + <Name>LoggingExtensions.Core</Name>
  48 + </ProjectReference>
  49 + </ItemGroup>
  50 + <ItemGroup>
  51 + <None Include="packages.config" />
  52 + <None Include="this.log-RhinoMocks.nuspec" />
  53 + </ItemGroup>
  54 + <ItemGroup>
  55 + <Content Include="ReadMe.txt" />
  56 + </ItemGroup>
  57 + <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
  58 + <!-- To modify your build process, add your task inside one of the targets below and uncomment it.
  59 + Other similar extension points exist, see Microsoft.Common.targets.
  60 + <Target Name="BeforeBuild">
  61 + </Target>
  62 + <Target Name="AfterBuild">
  63 + </Target>
  64 + -->
  65 +</Project>
107 LoggingExtensions.RhinoMocks/MockLogger.cs
... ... @@ -0,0 +1,107 @@
  1 +namespace LoggingExtensions.RhinoMocks
  2 +{
  3 + using System;
  4 + using System.Collections.Concurrent;
  5 + using System.Collections.Generic;
  6 + using Logging;
  7 + using Rhino.Mocks;
  8 +
  9 + public enum LogLevel
  10 + {
  11 + Debug,
  12 + Info,
  13 + Warn,
  14 + Error,
  15 + Fatal
  16 + }
  17 +
  18 + public class MockLogger : ILog, ILog<MockLogger>
  19 + {
  20 + private readonly Lazy<ConcurrentDictionary<string,IList<string>>> _messages = new Lazy<ConcurrentDictionary<string, IList<string>>>();
  21 + private ILog _logger = MockRepository.GenerateMock<ILog>();
  22 +
  23 + public ConcurrentDictionary<string, IList<string>> Messages
  24 + {
  25 + get { return _messages.Value; }
  26 + }
  27 +
  28 + public MockLogger() : base()
  29 + {
  30 + }
  31 +
  32 + public IList<string> MessagesFor(LogLevel logLevel)
  33 + {
  34 + return _messages.Value.GetOrAdd(logLevel.ToString(), new List<string>());
  35 + }
  36 +
  37 + public void InitializeFor(string loggerName)
  38 + {
  39 + }
  40 +
  41 + public void LogMessage(LogLevel logLevel, string message)
  42 + {
  43 + var list = _messages.Value.GetOrAdd(logLevel.ToString(), new List<string>());
  44 + list.Add(message);
  45 + }
  46 +
  47 + public void Debug(string message, params object[] formatting)
  48 + {
  49 + LogMessage(LogLevel.Debug, string.Format(message, formatting));
  50 + _logger.Debug(message, formatting);
  51 + }
  52 +
  53 + public void Debug(Func<string> message)
  54 + {
  55 + LogMessage(LogLevel.Debug, message());
  56 + _logger.Debug(message);
  57 + }
  58 +
  59 + public void Info(string message, params object[] formatting)
  60 + {
  61 + LogMessage(LogLevel.Info, string.Format(message, formatting));
  62 + _logger.Info(message, formatting);
  63 + }
  64 +
  65 + public void Info(Func<string> message)
  66 + {
  67 + LogMessage(LogLevel.Info, message());
  68 + _logger.Info(message);
  69 + }
  70 +
  71 + public void Warn(string message, params object[] formatting)
  72 + {
  73 + LogMessage(LogLevel.Warn, string.Format(message, formatting));
  74 + _logger.Warn(message, formatting);
  75 + }
  76 +
  77 + public void Warn(Func<string> message)
  78 + {
  79 + LogMessage(LogLevel.Warn, message());
  80 + _logger.Warn(message);
  81 + }
  82 +
  83 + public void Error(string message, params object[] formatting)
  84 + {
  85 + LogMessage(LogLevel.Error, string.Format(message, formatting));
  86 + _logger.Error(message, formatting);
  87 + }
  88 +
  89 + public void Error(Func<string> message)
  90 + {
  91 + LogMessage(LogLevel.Error, message());
  92 + _logger.Error(message);
  93 + }
  94 +
  95 + public void Fatal(string message, params object[] formatting)