Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Adding teh codez

  • Loading branch information...
commit a94ebf82331c3270a26aa8dc980c21ceaf9f49e2 1 parent 25fcb1d
@ferventcoder authored
Showing with 2,618 additions and 0 deletions.
  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
View
56 LoggingExtensions.Core/LogExtensions.cs.pp
@@ -0,0 +1,56 @@
+// ==============================================================================
+//
+// RealDimensions Software, LLC - Copyright © 2012 - Present - Released under the Apache 2.0 License
+//
+// Copyright 2007-2008 The Apache Software Foundation.
+//
+// Licensed 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 $rootnamespace$
+{
+ using System.Collections.Concurrent;
+ using LoggingExtensions.Logging;
+
+ /// <summary>
+ /// Extensions to help make logging awesome - this should be installed into the root namespace of your application
+ /// </summary>
+ public static class LogExtensions
+ {
+ /// <summary>
+ /// Concurrent dictionary that ensures only one instance of a logger for a type.
+ /// </summary>
+ private static readonly ConcurrentDictionary<string, ILog> _dictionary = new ConcurrentDictionary<string, ILog>();
+
+ /// <summary>
+ /// Gets the logger for <see cref="T"/>.
+ /// </summary>
+ /// <typeparam name="T"></typeparam>
+ /// <param name="type">The type to get the logger for.</param>
+ /// <returns>Instance of a logger for the object.</returns>
+ public static ILog Log<T>(this T type)
+ {
+ string objectName = typeof (T).FullName;
+ return Log(objectName);
+ }
+
+ /// <summary>
+ /// Gets the logger for the specified object name.
+ /// </summary>
+ /// <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>
+ /// <returns>Instance of a logger for the object.</returns>
+ public static ILog Log(this string objectName)
+ {
+ return _dictionary.GetOrAdd(objectName, LoggingExtensions.Logging.Log.GetLoggerFor);
+ }
+ }
+}
View
56 LoggingExtensions.Core/LogExtensions.vb.pp
@@ -0,0 +1,56 @@
+' ==============================================================================
+'
+' RealDimensions Software, LLC - Copyright © 2012 - Present - Released under the Apache 2.0 License
+'
+' Copyright 2007-2008 The Apache Software Foundation.
+'
+' Licensed 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.
+' ==============================================================================
+
+Imports System.Collections.Concurrent
+Imports System.Runtime.CompilerServices
+Imports LoggingExtensions.Logging
+
+''' <summary>
+''' Extensions to help make logging awesome - this should be installed into the root namespace of your application
+''' </summary>
+Public Module LogExtensions
+
+ ''' <summary>
+ ''' Concurrent dictionary that ensures only one instance of a logger for a type.
+ ''' </summary>
+ Private ReadOnly _dictionary As ConcurrentDictionary(Of String, ILog) = New ConcurrentDictionary(Of String, ILog)
+
+ ''' <summary>
+ ''' Gets the logger for <see cref="T"/>.
+ ''' </summary>
+ ''' <typeparam name="T"></typeparam>
+ ''' <param name="type">The type to get the logger for.</param>
+ ''' <returns>Instance of a logger for the object.</returns>
+ <Extension()>
+ Public Function Log(Of T)(type As T) As ILog
+ Dim objectName As String = GetType(T).FullName
+
+ Return Log(objectName)
+ End Function
+
+ ''' <summary>
+ ''' Gets the logger for the specified object name.
+ ''' </summary>
+ ''' <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>
+ ''' <returns>Instance of a logger for the object.</returns>
+ <Extension()>
+ Public Function Log(objectName As String) As ILog
+ Return _dictionary.GetOrAdd(objectName, Function(name) (LoggingExtensions.Logging.Log.GetLoggerFor(name)))
+ End Function
+
+End Module
View
89 LoggingExtensions.Core/Logging/ILog.cs
@@ -0,0 +1,89 @@
+namespace LoggingExtensions.Logging
+{
+ using System;
+
+ /// <summary>
+ /// Custom interface for logging messages
+ /// </summary>
+ public interface ILog
+ {
+ /// <summary>
+ /// Initializes the instance for the logger name
+ /// </summary>
+ /// <param name="loggerName">Name of the logger</param>
+ void InitializeFor(string loggerName);
+
+ /// <summary>
+ /// Debug level of the specified message. The other method is preferred since the execution is deferred.
+ /// </summary>
+ /// <param name="message">The message.</param>
+ /// <param name="formatting">The formatting.</param>
+ void Debug(string message, params object[] formatting);
+
+ /// <summary>
+ /// Debug level of the specified message.
+ /// </summary>
+ /// <param name="message">The message.</param>
+ void Debug(Func<string> message);
+
+ /// <summary>
+ /// Info level of the specified message. The other method is preferred since the execution is deferred.
+ /// </summary>
+ /// <param name="message">The message.</param>
+ /// <param name="formatting">The formatting.</param>
+ void Info(string message, params object[] formatting);
+
+ /// <summary>
+ /// Info level of the specified message.
+ /// </summary>
+ /// <param name="message">The message.</param>
+ void Info(Func<string> message);
+
+ /// <summary>
+ /// Warn level of the specified message. The other method is preferred since the execution is deferred.
+ /// </summary>
+ /// <param name="message">The message.</param>
+ /// <param name="formatting">The formatting.</param>
+ void Warn(string message, params object[] formatting);
+
+ /// <summary>
+ /// Warn level of the specified message.
+ /// </summary>
+ /// <param name="message">The message.</param>
+ void Warn(Func<string> message);
+
+ /// <summary>
+ /// Error level of the specified message. The other method is preferred since the execution is deferred.
+ /// </summary>
+ /// <param name="message">The message.</param>
+ /// <param name="formatting">The formatting.</param>
+ void Error(string message, params object[] formatting);
+
+ /// <summary>
+ /// Error level of the specified message.
+ /// </summary>
+ /// <param name="message">The message.</param>
+ void Error(Func<string> message);
+
+ /// <summary>
+ /// Fatal level of the specified message. The other method is preferred since the execution is deferred.
+ /// </summary>
+ /// <param name="message">The message.</param>
+ /// <param name="formatting">The formatting.</param>
+ void Fatal(string message, params object[] formatting);
+
+ /// <summary>
+ /// Fatal level of the specified message.
+ /// </summary>
+ /// <param name="message">The message.</param>
+ void Fatal(Func<string> message);
+ }
+
+ /// <summary>
+ /// Ensures a default constructor for the logger type
+ /// </summary>
+ /// <typeparam name="T"></typeparam>
+ public interface ILog<T> //where T : new()
+ {
+ }
+}
View
55 LoggingExtensions.Core/Logging/Log.cs
@@ -0,0 +1,55 @@
+namespace LoggingExtensions.Logging
+{
+ using System;
+ using System.Collections.Concurrent;
+ using System.ComponentModel;
+
+ /// <summary>
+ /// Logger type initialization
+ /// </summary>
+ public static class Log
+ {
+ private static Type _logType = typeof(NullLog);
+ private static ILog _testLogger;
+
+ /// <summary>
+ /// Sets up logging to be with a certain type
+ /// </summary>
+ /// <typeparam name="T">The type of ILog for the application to use</typeparam>
+ public static void InitializeWith<T>() where T : ILog, new()
+ {
+ _logType = typeof(T);
+ }
+
+ /// <summary>
+ /// Sets up logging to be with a certain instance. The other method is preferred.
+ /// </summary>
+ /// <param name="testLoggerType">Type of the logger.</param>
+ /// <remarks>This is mostly geared towards testing</remarks>
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public static void InitializeWith(ILog testLoggerType)
+ {
+ _logType = testLoggerType.GetType();
+ _testLogger = testLoggerType;
+ }
+
+ /// <summary>
+ /// Initializes a new instance of a logger for an object.
+ /// This should be done only once per object name.
+ /// </summary>
+ /// <param name="objectName">Name of the object.</param>
+ /// <returns>ILog instance for an object if log type has been intialized; otherwise null</returns>
+ public static ILog GetLoggerFor(string objectName)
+ {
+ if (_testLogger != null) return _testLogger;
+
+ var logger = Activator.CreateInstance(_logType) as ILog;
+ if (logger != null)
+ {
+ logger.InitializeFor(objectName);
+ }
+
+ return logger;
+ }
+ }
+}
View
54 LoggingExtensions.Core/Logging/NullLog.cs
@@ -0,0 +1,54 @@
+namespace LoggingExtensions.Logging
+{
+ using System;
+
+ /// <summary>
+ /// The default logger until one is set.
+ /// </summary>
+ public class NullLog : ILog, ILog<NullLog>
+ {
+ public void InitializeFor(string loggerName)
+ {
+ }
+
+ public void Debug(string message, params object[] formatting)
+ {
+ }
+
+ public void Debug(Func<string> message)
+ {
+ }
+
+ public void Info(string message, params object[] formatting)
+ {
+ }
+
+ public void Info(Func<string> message)
+ {
+ }
+
+ public void Warn(string message, params object[] formatting)
+ {
+ }
+
+ public void Warn(Func<string> message)
+ {
+ }
+
+ public void Error(string message, params object[] formatting)
+ {
+ }
+
+ public void Error(Func<string> message)
+ {
+ }
+
+ public void Fatal(string message, params object[] formatting)
+ {
+ }
+
+ public void Fatal(Func<string> message)
+ {
+ }
+ }
+}
View
57 LoggingExtensions.Core/LoggingExtensions.Core.csproj
@@ -0,0 +1,57 @@
+<?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>{F61EB8DD-2E99-4E3B-96F0-8015FC6FB880}</ProjectGuid>
+ <OutputType>Library</OutputType>
+ <AppDesignerFolder>Properties</AppDesignerFolder>
+ <RootNamespace>LoggingExtensions</RootNamespace>
+ <AssemblyName>this.Log</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="System" />
+ <Reference Include="System.Core" />
+ </ItemGroup>
+ <ItemGroup>
+ <Compile Include="Logging\ILog.cs" />
+ <Compile Include="Logging\Log.cs" />
+ <Content Include="ReadMe.txt" />
+ <Content Include="LogExtensions.cs.pp" />
+ <Compile Include="Logging\NullLog.cs" />
+ <Compile Include="Properties\AssemblyInfo.cs" />
+ </ItemGroup>
+ <ItemGroup>
+ <None Include="LogExtensions.vb.pp" />
+ <None Include="this.Log.nuspec" />
+ </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
36 LoggingExtensions.Core/Properties/AssemblyInfo.cs
@@ -0,0 +1,36 @@
+using System.Reflection;
+using System.Runtime.CompilerServices;
+using System.Runtime.InteropServices;
+
+// General Information about an assembly is controlled through the following
+// set of attributes. Change these attribute values to modify the information
+// associated with an assembly.
+[assembly: AssemblyTitle("this.Log Logging Extension")]
+[assembly: AssemblyDescription("")]
+[assembly: AssemblyConfiguration("")]
+[assembly: AssemblyCompany("RealDimensions Software, LLC")]
+[assembly: AssemblyProduct("this.Log")]
+[assembly: AssemblyCopyright("Copyright © 2012 RealDimensions Software, LLC")]
+[assembly: AssemblyTrademark("")]
+[assembly: AssemblyCulture("")]
+
+// Setting ComVisible to false makes the types in this assembly not visible
+// to COM components. If you need to access a type in this assembly from
+// COM, set the ComVisible attribute to true on that type.
+[assembly: ComVisible(false)]
+
+// The following GUID is for the ID of the typelib if this project is exposed to COM
+[assembly: Guid("bfbc3bef-c6e7-4dfd-92ed-2fa2ab6335ef")]
+
+// Version information for an assembly consists of the following four values:
+//
+// Major Version
+// Minor Version
+// Build Number
+// Revision
+//
+// You can specify all the values or you can default the Build and Revision Numbers
+// by using the '*' as shown below:
+// [assembly: AssemblyVersion("1.0.*")]
+[assembly: AssemblyVersion("0.0.1.0")]
+[assembly: AssemblyFileVersion("0.0.1.0")]
View
4 LoggingExtensions.Core/ReadMe.txt
@@ -0,0 +1,4 @@
+this.Log
+========
+
+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.
View
21 LoggingExtensions.Core/this.Log.nuspec
@@ -0,0 +1,21 @@
+<?xml version="1.0"?>
+<package >
+ <metadata>
+ <id>$id$</id>
+ <version>$version$</version>
+ <title>$title$</title>
+ <authors>$author$</authors>
+ <owners>Rob Reynolds</owners>
+ <projectUrl>https://github.com/ferventcoder/this.Log</projectUrl>
+ <licenseUrl>https://raw.github.com/ferventcoder/this.Log/master/LICENSE</licenseUrl>
+ <requireLicenseAcceptance>false</requireLicenseAcceptance>
+ <summary>this.Log - Logging Extensions that work in all code locations</summary>
+ <description>this.Log is a Logging Extension that works in all code locations.
+This package by itself only brings the logging extension and allows you to call this.Log().Debug, etc.
+What it doesn't bring though is a logging facility. Please search nuget for this.Log to see the facilities.
+ </description>
+ <releaseNotes></releaseNotes>
+ <copyright>Copyright 2012</copyright>
+ <tags>logging log this.Log</tags>
+ </metadata>
+</package>
View
65 LoggingExtensions.Moq/LoggingExtensions.Moq.csproj
@@ -0,0 +1,65 @@
+<?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>{00127809-D90C-470E-8729-DF5D66695A6D}</ProjectGuid>
+ <OutputType>Library</OutputType>
+ <AppDesignerFolder>Properties</AppDesignerFolder>
+ <RootNamespace>LoggingExtensions.Moq</RootNamespace>
+ <AssemblyName>this.log-moq</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="Moq">
+ <HintPath>..\packages\Moq.4.0.10827\lib\NET40\Moq.dll</HintPath>
+ </Reference>
+ <Reference Include="System" />
+ <Reference Include="System.Core" />
+ </ItemGroup>
+ <ItemGroup>
+ <Compile Include="MockLogger.cs" />
+ <Compile Include="Properties\AssemblyInfo.cs" />
+ </ItemGroup>
+ <ItemGroup>
+ <ProjectReference Include="..\LoggingExtensions.Core\LoggingExtensions.Core.csproj">
+ <Project>{F61EB8DD-2E99-4E3B-96F0-8015FC6FB880}</Project>
+ <Name>LoggingExtensions.Core</Name>
+ </ProjectReference>
+ </ItemGroup>
+ <ItemGroup>
+ <None Include="packages.config" />
+ <None Include="this.log-Moq.nuspec" />
+ </ItemGroup>
+ <ItemGroup>
+ <Content Include="ReadMe.txt" />
+ </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
100 LoggingExtensions.Moq/MockLogger.cs
@@ -0,0 +1,100 @@
+namespace LoggingExtensions.Moq
+{
+ using System;
+ using System.Collections.Concurrent;
+ using System.Collections.Generic;
+ using Logging;
+ using global::Moq;
+
+ public enum LogLevel
+ {
+ Debug,
+ Info,
+ Warn,
+ Error,
+ Fatal
+ }
+
+ public class MockLogger : Mock<ILog>, ILog, ILog<MockLogger>
+ {
+ private readonly Lazy<ConcurrentDictionary<string, IList<string>>> _messages = new Lazy<ConcurrentDictionary<string, IList<string>>>();
+
+ public ConcurrentDictionary<string, IList<string>> Messages
+ {
+ get { return _messages.Value; }
+ }
+
+ public IList<string> MessagesFor(LogLevel logLevel)
+ {
+ return _messages.Value.GetOrAdd(logLevel.ToString(), new List<string>());
+ }
+
+ public void InitializeFor(string loggerName) {}
+
+ public void LogMessage(LogLevel logLevel, string message)
+ {
+ var list = _messages.Value.GetOrAdd(logLevel.ToString(), new List<string>());
+ list.Add(message);
+ }
+
+ public void Debug(string message, params object[] formatting)
+ {
+ LogMessage(LogLevel.Debug, string.Format(message,formatting));
+ Object.Debug(message, formatting);
+ }
+
+ public void Debug(Func<string> message)
+ {
+ LogMessage(LogLevel.Debug, message());
+ Object.Debug(message);
+ }
+
+ public void Info(string message, params object[] formatting)
+ {
+ LogMessage(LogLevel.Info, string.Format(message, formatting));
+ Object.Info(message, formatting);
+ }
+
+ public void Info(Func<string> message)
+ {
+ LogMessage(LogLevel.Info, message());
+ Object.Info(message);
+ }
+
+ public void Warn(string message, params object[] formatting)
+ {
+ LogMessage(LogLevel.Warn, string.Format(message, formatting));
+ Object.Warn(message, formatting);
+ }
+
+ public void Warn(Func<string> message)
+ {
+ LogMessage(LogLevel.Warn, message());
+ Object.Warn(message);
+ }
+
+ public void Error(string message, params object[] formatting)
+ {
+ LogMessage(LogLevel.Error, string.Format(message, formatting));
+ Object.Error(message, formatting);
+ }
+
+ public void Error(Func<string> message)
+ {
+ LogMessage(LogLevel.Error, message());
+ Object.Error(message);
+ }
+
+ public void Fatal(string message, params object[] formatting)
+ {
+ LogMessage(LogLevel.Fatal, string.Format(message, formatting));
+ Object.Fatal(message, formatting);
+ }
+
+ public void Fatal(Func<string> message)
+ {
+ LogMessage(LogLevel.Fatal, message());
+ Object.Fatal(message);
+ }
+ }
+}
View
36 LoggingExtensions.Moq/Properties/AssemblyInfo.cs
@@ -0,0 +1,36 @@
+using System.Reflection;
+using System.Runtime.CompilerServices;
+using System.Runtime.InteropServices;
+
+// General Information about an assembly is controlled through the following
+// set of attributes. Change these attribute values to modify the information
+// associated with an assembly.
+[assembly: AssemblyTitle("this.Log Logging Extension (Moq Plugin)")]
+[assembly: AssemblyDescription("")]
+[assembly: AssemblyConfiguration("")]
+[assembly: AssemblyCompany("RealDimensions Software, LLC")]
+[assembly: AssemblyProduct("this.Log-Moq")]
+[assembly: AssemblyCopyright("Copyright © 2012 RealDimensions Software, LLC")]
+[assembly: AssemblyTrademark("")]
+[assembly: AssemblyCulture("")]
+
+// Setting ComVisible to false makes the types in this assembly not visible
+// to COM components. If you need to access a type in this assembly from
+// COM, set the ComVisible attribute to true on that type.
+[assembly: ComVisible(false)]
+
+// The following GUID is for the ID of the typelib if this project is exposed to COM
+[assembly: Guid("4ca2ae68-adcc-4924-b1b5-925febe1637e")]
+
+// Version information for an assembly consists of the following four values:
+//
+// Major Version
+// Minor Version
+// Build Number
+// Revision
+//
+// You can specify all the values or you can default the Build and Revision Numbers
+// by using the '*' as shown below:
+// [assembly: AssemblyVersion("1.0.*")]
+[assembly: AssemblyVersion("0.0.1.0")]
+[assembly: AssemblyFileVersion("0.0.1.0")]
View
7 LoggingExtensions.Moq/ReadMe.txt
@@ -0,0 +1,7 @@
+this.Log-Moq
+============
+
+In your application startup, please include these lines:
+
+Logger = new LoggingExtensions.Moq.MockLogger();
+LoggingExtensions.Logging.Log.InitializeWith(Logger);
View
4 LoggingExtensions.Moq/packages.config
@@ -0,0 +1,4 @@
+<?xml version="1.0" encoding="utf-8"?>
+<packages>
+ <package id="Moq" version="4.0.10827" targetFramework="net40" />
+</packages>
View
22 LoggingExtensions.Moq/this.log-Moq.nuspec
@@ -0,0 +1,22 @@
+<?xml version="1.0"?>
+<package >
+ <metadata>
+ <id>$id$</id>
+ <version>$version$</version>
+ <title>$title$</title>
+ <authors>$author$</authors>
+ <owners>Rob Reynolds</owners>
+ <projectUrl>https://github.com/ferventcoder/this.Log</projectUrl>
+ <licenseUrl>https://raw.github.com/ferventcoder/this.Log/master/LICENSE</licenseUrl>
+ <requireLicenseAcceptance>false</requireLicenseAcceptance>
+ <summary>this.Log-Moq - this.Log logging extension using Moq</summary>
+ <description>this.Log-Moq is the Moq plugin to this.Log logging extension that brings the MockLogger.</description>
+ <releaseNotes></releaseNotes>
+ <copyright>Copyright 2012</copyright>
+ <tags>logging log this.Log testing moq</tags>
+ <dependencies>
+ <dependency id="this.Log" version="0.0.1.0" />
+ <dependency id="Moq" version="4.0.10827" />
+ </dependencies>
+ </metadata>
+</package>
View
65 LoggingExtensions.NLog/LoggingExtensions.NLog.csproj
@@ -0,0 +1,65 @@
+<?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>{E045C968-1B32-493F-A3C1-B428A2789F44}</ProjectGuid>
+ <OutputType>Library</OutputType>
+ <AppDesignerFolder>Properties</AppDesignerFolder>
+ <RootNamespace>LoggingExtensions.NLog</RootNamespace>
+ <AssemblyName>this.Log-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="NLogLog.cs" />
+ <Compile Include="Properties\AssemblyInfo.cs" />
+ </ItemGroup>
+ <ItemGroup>
+ <None Include="packages.config" />
+ <None Include="this.Log-NLog.nuspec" />
+ </ItemGroup>
+ <ItemGroup>
+ <ProjectReference Include="..\LoggingExtensions.Core\LoggingExtensions.Core.csproj">
+ <Project>{F61EB8DD-2E99-4E3B-96F0-8015FC6FB880}</Project>
+ <Name>LoggingExtensions.Core</Name>
+ </ProjectReference>
+ </ItemGroup>
+ <ItemGroup>
+ <Content Include="ReadMe.txt" />
+ </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
74 LoggingExtensions.NLog/NLogLog.cs
@@ -0,0 +1,74 @@
+namespace LoggingExtensions.NLog
+{
+ using System;
+ using Logging;
+ using LoggingExtensions;
+ using global::NLog;
+
+ /// <summary>
+ /// Log4net logger implementing special ILog class
+ /// </summary>
+ public class NLogLog : ILog, ILog<NLogLog>
+ {
+ private Logger _logger;
+
+ public void InitializeFor(string loggerName)
+ {
+ _logger = LogManager.GetLogger(loggerName);
+ }
+
+ public void Debug(string message, params object[] formatting)
+ {
+ if (_logger.IsDebugEnabled) _logger.Debug(message, formatting);
+ }
+
+ public void Debug(Func<string> message)
+ {
+ if (_logger.IsDebugEnabled) _logger.Debug(message());
+ }
+
+ public void Info(string message, params object[] formatting)
+ {
+ if (_logger.IsInfoEnabled) _logger.Info(message, formatting);
+ }
+
+ public void Info(Func<string> message)
+ {
+ if (_logger.IsInfoEnabled) _logger.Info(message());
+ }
+
+ public void Warn(string message, params object[] formatting)
+ {
+ if (_logger.IsWarnEnabled) _logger.Warn(message, formatting);
+ }
+
+ public void Warn(Func<string> message)
+ {
+ if (_logger.IsWarnEnabled) _logger.Warn(message());
+ }
+
+ public void Error(string message, params object[] formatting)
+ {
+ // don't check for enabled at this level
+ _logger.Error(message, formatting);
+ }
+
+ public void Error(Func<string> message)
+ {
+ // don't check for enabled at this level
+ _logger.Error(message());
+ }
+
+ public void Fatal(string message, params object[] formatting)
+ {
+ // don't check for enabled at this level
+ _logger.Fatal(message, formatting);
+ }
+
+ public void Fatal(Func<string> message)
+ {
+ // don't check for enabled at this level
+ _logger.Fatal(message());
+ }
+ }
+}
View
36 LoggingExtensions.NLog/Properties/AssemblyInfo.cs
@@ -0,0 +1,36 @@
+using System.Reflection;
+using System.Runtime.CompilerServices;
+using System.Runtime.InteropServices;
+
+// General Information about an assembly is controlled through the following
+// set of attributes. Change these attribute values to modify the information
+// associated with an assembly.
+[assembly: AssemblyTitle("this.Log Logging Extension (NLog Plugin)")]
+[assembly: AssemblyDescription("")]
+[assembly: AssemblyConfiguration("")]
+[assembly: AssemblyCompany("RealDimensions Software, LLC")]
+[assembly: AssemblyProduct("this.Log-NLog")]
+[assembly: AssemblyCopyright("Copyright © 2012 RealDimensions Software, LLC")]
+[assembly: AssemblyTrademark("")]
+[assembly: AssemblyCulture("")]
+
+// Setting ComVisible to false makes the types in this assembly not visible
+// to COM components. If you need to access a type in this assembly from
+// COM, set the ComVisible attribute to true on that type.
+[assembly: ComVisible(false)]
+
+// The following GUID is for the ID of the typelib if this project is exposed to COM
+[assembly: Guid("c0c7f4f5-2ee7-45ee-a1c3-25de40fbc64a")]
+
+// Version information for an assembly consists of the following four values:
+//
+// Major Version
+// Minor Version
+// Build Number
+// Revision
+//
+// You can specify all the values or you can default the Build and Revision Numbers
+// by using the '*' as shown below:
+// [assembly: AssemblyVersion("1.0.*")]
+[assembly: AssemblyVersion("0.0.1.0")]
+[assembly: AssemblyFileVersion("0.0.1.0")]
View
6 LoggingExtensions.NLog/ReadMe.txt
@@ -0,0 +1,6 @@
+this.Log-NLog
+=============
+
+In your application startup, please include this line:
+
+Log.InitializeWith<NLogLog>();
View
4 LoggingExtensions.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
22 LoggingExtensions.NLog/this.Log-NLog.nuspec
@@ -0,0 +1,22 @@
+<?xml version="1.0"?>
+<package >
+ <metadata>
+ <id>$id$</id>
+ <version>$version$</version>
+ <title>$title$</title>
+ <authors>$author$</authors>
+ <owners>Rob Reynolds</owners>
+ <projectUrl>https://github.com/ferventcoder/this.Log</projectUrl>
+ <licenseUrl>https://raw.github.com/ferventcoder/this.Log/master/LICENSE</licenseUrl>
+ <requireLicenseAcceptance>false</requireLicenseAcceptance>
+ <summary>this.Log-NLog - this.Log logging extension using NLog</summary>
+ <description>this.Log-NLog</description>
+ <releaseNotes></releaseNotes>
+ <copyright>Copyright 2012</copyright>
+ <tags>logging log this.Log nlog</tags>
+ <dependencies>
+ <dependency id="this.Log" version="0.0.1.0" />
+ <dependency id="NLog" version="2.0.0.2000" />
+ </dependencies>
+ </metadata>
+</package>
View
65 LoggingExtensions.RhinoMocks/LoggingExtensions.RhinoMocks.csproj
@@ -0,0 +1,65 @@
+<?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>{E7D6D2FF-254B-4720-BEC5-E45305621A0D}</ProjectGuid>
+ <OutputType>Library</OutputType>
+ <AppDesignerFolder>Properties</AppDesignerFolder>
+ <RootNamespace>LoggingExtensions.RhinoMocks</RootNamespace>
+ <AssemblyName>this.Log-RhinoMocks</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="Rhino.Mocks">
+ <HintPath>..\packages\RhinoMocks.3.6.1\lib\net\Rhino.Mocks.dll</HintPath>
+ </Reference>
+ <Reference Include="System" />
+ <Reference Include="System.Core" />
+ </ItemGroup>
+ <ItemGroup>
+ <Compile Include="MockLogger.cs" />
+ <Compile Include="Properties\AssemblyInfo.cs" />
+ </ItemGroup>
+ <ItemGroup>
+ <ProjectReference Include="..\LoggingExtensions.Core\LoggingExtensions.Core.csproj">
+ <Project>{F61EB8DD-2E99-4E3B-96F0-8015FC6FB880}</Project>
+ <Name>LoggingExtensions.Core</Name>
+ </ProjectReference>
+ </ItemGroup>
+ <ItemGroup>
+ <None Include="packages.config" />
+ <None Include="this.log-RhinoMocks.nuspec" />
+ </ItemGroup>
+ <ItemGroup>
+ <Content Include="ReadMe.txt" />
+ </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
107 LoggingExtensions.RhinoMocks/MockLogger.cs
@@ -0,0 +1,107 @@
+namespace LoggingExtensions.RhinoMocks
+{
+ using System;
+ using System.Collections.Concurrent;
+ using System.Collections.Generic;
+ using Logging;
+ using Rhino.Mocks;
+
+ public enum LogLevel
+ {
+ Debug,
+ Info,
+ Warn,
+ Error,
+ Fatal
+ }
+
+ public class MockLogger : ILog, ILog<MockLogger>
+ {
+ private readonly Lazy<ConcurrentDictionary<string,IList<string>>> _messages = new Lazy<ConcurrentDictionary<string, IList<string>>>();
+ private ILog _logger = MockRepository.GenerateMock<ILog>();
+
+ public ConcurrentDictionary<string, IList<string>> Messages
+ {
+ get { return _messages.Value; }
+ }
+
+ public MockLogger() : base()
+ {
+ }
+
+ public IList<string> MessagesFor(LogLevel logLevel)
+ {
+ return _messages.Value.GetOrAdd(logLevel.ToString(), new List<string>());
+ }
+
+ public void InitializeFor(string loggerName)
+ {
+ }
+
+ public void LogMessage(LogLevel logLevel, string message)
+ {
+ var list = _messages.Value.GetOrAdd(logLevel.ToString(), new List<string>());
+ list.Add(message);
+ }
+
+ public void Debug(string message, params object[] formatting)
+ {
+ LogMessage(LogLevel.Debug, string.Format(message, formatting));
+ _logger.Debug(message, formatting);
+ }
+
+ public void Debug(Func<string> message)
+ {
+ LogMessage(LogLevel.Debug, message());
+ _logger.Debug(message);
+ }
+
+ public void Info(string message, params object[] formatting)
+ {
+ LogMessage(LogLevel.Info, string.Format(message, formatting));
+ _logger.Info(message, formatting);
+ }
+
+ public void Info(Func<string> message)
+ {
+ LogMessage(LogLevel.Info, message());
+ _logger.Info(message);
+ }
+
+ public void Warn(string message, params object[] formatting)
+ {
+ LogMessage(LogLevel.Warn, string.Format(message, formatting));
+ _logger.Warn(message, formatting);
+ }
+
+ public void Warn(Func<string> message)
+ {
+ LogMessage(LogLevel.Warn, message());
+ _logger.Warn(message);
+ }
+
+ public void Error(string message, params object[] formatting)
+ {
+ LogMessage(LogLevel.Error, string.Format(message, formatting));
+ _logger.Error(message, formatting);
+ }
+
+ public void Error(Func<string> message)
+ {
+ LogMessage(LogLevel.Error, message());
+ _logger.Error(message);
+ }
+
+ public void Fatal(string message, params object[] formatting)
+ {
+ LogMessage(LogLevel.Fatal, string.Format(message, formatting));
+ _logger.Fatal(message, formatting);
+ }
+
+ public void Fatal(Func<string> message)
+ {
+ LogMessage(LogLevel.Fatal, message());
+ _logger.Fatal(message);
+ }
+ }
+}
View
36 LoggingExtensions.RhinoMocks/Properties/AssemblyInfo.cs
@@ -0,0 +1,36 @@
+using System.Reflection;
+using System.Runtime.CompilerServices;
+using System.Runtime.InteropServices;
+
+// General Information about an assembly is controlled through the following
+// set of attributes. Change these attribute values to modify the information
+// associated with an assembly.
+[assembly: AssemblyTitle("this.Log Logging Extension (Rhino Mocks Plugin)")]
+[assembly: AssemblyDescription("")]
+[assembly: AssemblyConfiguration("")]
+[assembly: AssemblyCompany("RealDimensions Software, LLC")]
+[assembly: AssemblyProduct("this.Log-RhinoMocks")]
+[assembly: AssemblyCopyright("Copyright © 2012 RealDimensions Software, LLC")]
+[assembly: AssemblyTrademark("")]
+[assembly: AssemblyCulture("")]
+
+// Setting ComVisible to false makes the types in this assembly not visible
+// to COM components. If you need to access a type in this assembly from
+// COM, set the ComVisible attribute to true on that type.
+[assembly: ComVisible(false)]
+
+// The following GUID is for the ID of the typelib if this project is exposed to COM
+[assembly: Guid("77aa9f2e-8c36-4e60-bcfe-80d3c1d78f56")]
+
+// Version information for an assembly consists of the following four values:
+//
+// Major Version
+// Minor Version
+// Build Number
+// Revision
+//
+// You can specify all the values or you can default the Build and Revision Numbers
+// by using the '*' as shown below:
+// [assembly: AssemblyVersion("1.0.*")]
+[assembly: AssemblyVersion("1.0.0.0")]
+[assembly: AssemblyFileVersion("1.0.0.0")]
View
7 LoggingExtensions.RhinoMocks/ReadMe.txt
@@ -0,0 +1,7 @@
+this.Log-RhinoMocks
+===================
+
+In your application startup, please include these lines:
+
+Logger = new LoggingExtensions.RhinoMocks.MockLogger();
+LoggingExtensions.Logging.Log.InitializeWith(Logger);
View
4 LoggingExtensions.RhinoMocks/packages.config
@@ -0,0 +1,4 @@
+<?xml version="1.0" encoding="utf-8"?>
+<packages>
+ <package id="RhinoMocks" version="3.6.1" targetFramework="net40" />
+</packages>
View
22 LoggingExtensions.RhinoMocks/this.log-RhinoMocks.nuspec
@@ -0,0 +1,22 @@
+<?xml version="1.0"?>
+<package >
+ <metadata>
+ <id>$id$</id>
+ <version>$version$</version>
+ <title>$title$</title>
+ <authors>$author$</authors>
+ <owners>Rob Reynolds</owners>
+ <projectUrl>https://github.com/ferventcoder/this.Log</projectUrl>
+ <licenseUrl>https://raw.github.com/ferventcoder/this.Log/master/LICENSE</licenseUrl>
+ <requireLicenseAcceptance>false</requireLicenseAcceptance>
+ <summary>this.Log-RhinoMocks - this.Log logging extension using Rhino Mocks</summary>
+ <description>this.Log-RhinoMocks</description>
+ <releaseNotes></releaseNotes>
+ <copyright>Copyright 2012</copyright>
+ <tags>logging log this.Log rhino rhino.mocks rhinomocks</tags>
+ <dependencies>
+ <dependency id="this.Log" version="0.0.1.0" />
+ <dependency id="RhinoMocks" version="3.6.1" />
+ </dependencies>
+ </metadata>
+</package>
View
64 LoggingExtensions.Tests/LogExtensions.cs
@@ -0,0 +1,64 @@
+// ==============================================================================
+//
+// RealDimensions Software, LLC - Copyright © 2012 - Present - Released under the Apache 2.0 License
+//
+// Copyright 2007-2008 The Apache Software Foundation.
+//
+// Licensed 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 LoggingExtensions.Tests
+{
+ using System;
+ using System.Collections.Concurrent;
+ using LoggingExtensions.Logging;
+
+ /// <summary>
+ /// Extensions to help make logging awesome - this should be installed into the root namespace of your application
+ /// </summary>
+ public static class LogExtensions
+ {
+ /// <summary>
+ /// Concurrent dictionary that ensures only one instance of a logger for a type.
+ /// </summary>
+ private static readonly ConcurrentDictionary<string, ILog> _dictionary = new ConcurrentDictionary<string, ILog>();
+
+ /// <summary>
+ /// Concurrent dictionary that reduces hits to reflection for every log call.
+ /// </summary>
+ private static readonly ConcurrentDictionary<Type, string> _typeDictionary = new ConcurrentDictionary<Type, string>();
+
+
+ /// <summary>
+ /// Gets the logger for <see cref="T"/>.
+ /// </summary>
+ /// <typeparam name="T"></typeparam>
+ /// <param name="type">The type to get the logger for.</param>
+ /// <returns>Instance of a logger for the object.</returns>
+ public static ILog Log<T>(this T type)
+ {
+ //string objectName = _typeDictionary.GetOrAdd(typeof(T), typeof(T).FullName);
+ string objectName = typeof (T).FullName;
+ return Log(objectName);
+ }
+
+ /// <summary>
+ /// Gets the logger for the specified object name.
+ /// </summary>
+ /// <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>
+ /// <returns>Instance of a logger for the object.</returns>
+ public static ILog Log(this string objectName)
+ {
+ return _dictionary.GetOrAdd(objectName, LoggingExtensions.Logging.Log.GetLoggerFor);
+ }
+ }
+}
View
90 LoggingExtensions.Tests/LoggingExtensions.Tests.csproj
@@ -0,0 +1,90 @@
+<?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>{CD282107-FCA4-428A-AE8F-B373F83862A1}</ProjectGuid>
+ <OutputType>Library</OutputType>
+ <AppDesignerFolder>Properties</AppDesignerFolder>
+ <RootNamespace>LoggingExtensions.Tests</RootNamespace>
+ <AssemblyName>LoggingExtensions.Tests</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="log4net, Version=1.2.10.0, Culture=neutral, PublicKeyToken=1b44e1d426115821, processorArchitecture=MSIL">
+ <Private>True</Private>
+ <HintPath>..\packages\log4net.1.2.10\lib\2.0\log4net.dll</HintPath>
+ </Reference>
+ <Reference Include="Moq">
+ <HintPath>..\packages\Moq.4.0.10827\lib\NET40\Moq.dll</HintPath>
+ </Reference>
+ <Reference Include="NLog, Version=2.0.0.0, Culture=neutral, PublicKeyToken=5120e14c03d0593c, processorArchitecture=MSIL">
+ <HintPath>..\packages\NLog.2.0.0.2000\lib\net40\NLog.dll</HintPath>
+ </Reference>
+ <Reference Include="nunit.framework, Version=2.5.10.11092, Culture=neutral, PublicKeyToken=96d09a1eb7f44a77, processorArchitecture=MSIL">
+ <HintPath>..\packages\NUnit.2.5.10.11092\lib\nunit.framework.dll</HintPath>
+ </Reference>
+ <Reference Include="Should">
+ <HintPath>..\packages\Should.1.1.12.0\lib\Should.dll</HintPath>
+ </Reference>
+ <Reference Include="System" />
+ <Reference Include="System.Core" />
+ </ItemGroup>
+ <ItemGroup>
+ <Compile Include="Performance\Log4NetPerformanceSpecs.cs" />
+ <Compile Include="Properties\AssemblyInfo.cs" />
+ <Compile Include="TinySpec.cs" />
+ </ItemGroup>
+ <ItemGroup>
+ <ProjectReference Include="..\LoggingExtensions.Core\LoggingExtensions.Core.csproj">
+ <Project>{F61EB8DD-2E99-4E3B-96F0-8015FC6FB880}</Project>
+ <Name>LoggingExtensions.Core</Name>
+ </ProjectReference>
+ <ProjectReference Include="..\LoggingExtensions.log4net\LoggingExtensions.log4net.csproj">
+ <Project>{8BE8A851-0592-4FAA-8BAD-E0380AA9A903}</Project>
+ <Name>LoggingExtensions.log4net</Name>
+ </ProjectReference>
+ <ProjectReference Include="..\LoggingExtensions.Moq\LoggingExtensions.Moq.csproj">
+ <Project>{00127809-D90C-470E-8729-DF5D66695A6D}</Project>
+ <Name>LoggingExtensions.Moq</Name>
+ </ProjectReference>
+ <ProjectReference Include="..\LoggingExtensions.NLog\LoggingExtensions.NLog.csproj">
+ <Project>{E045C968-1B32-493F-A3C1-B428A2789F44}</Project>
+ <Name>LoggingExtensions.NLog</Name>
+ </ProjectReference>
+ </ItemGroup>
+ <ItemGroup>
+ <Compile Include="LogExtensions.cs" />
+ </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
140 LoggingExtensions.Tests/Performance/Log4NetPerformanceSpecs.cs
@@ -0,0 +1,140 @@
+namespace LoggingExtensions.Tests.Performance
+{
+ using System;
+ using System.Diagnostics;
+ using global::log4net;
+ using log4net;
+
+ public class Log4NetPerformanceSpecs
+ {
+ public abstract class Log4NetPerformanceSpecsBase : TinySpec
+ {
+ protected int NumberOfIterations = 100000;
+ protected Stopwatch stopwatch;
+
+ public override void Context()
+ {
+ stopwatch = new Stopwatch();
+ }
+ public override void Because()
+ {
+ stopwatch.Reset();
+ }
+ }
+
+ public class when_using_log4net_to_baseline_performance : Log4NetPerformanceSpecsBase
+ {
+ [Fact]
+ public void with_many_iterations_of_getting_a_logger()
+ {
+ stopwatch.Reset();
+ stopwatch.Start();
+ for (int i = 0; i < NumberOfIterations; i++)
+ {
+ LogManager.GetLogger(typeof(Log4NetPerformanceSpecsBase).FullName);
+ }
+ stopwatch.Stop();
+ Console.WriteLine("Native LogManager calls over '{0}' iterations took approximately '{1}' milliseconds. This is on average '{2}' ticks per call.", NumberOfIterations, stopwatch.ElapsedMilliseconds, (stopwatch.ElapsedTicks / NumberOfIterations));
+ }
+
+ [Fact]
+ public void with_many_iterations_of_logging()
+ {
+ var logger = LogManager.GetLogger(typeof(Log4NetPerformanceSpecsBase).FullName);
+ stopwatch.Reset();
+ stopwatch.Start();
+ for (int i = 0; i < NumberOfIterations; i++)
+ {
+ logger.Debug("Here's a message");
+ }
+ stopwatch.Stop();
+ Console.WriteLine("Native Logging calls over '{0}' iterations took approximately '{1}' milliseconds. This is on average '{2}' ticks per call.", NumberOfIterations, stopwatch.ElapsedMilliseconds, (stopwatch.ElapsedTicks / NumberOfIterations));
+ }
+ }
+
+ public class when_using_static_log_gateway_to_compare_performance : Log4NetPerformanceSpecsBase
+ {
+ public override void Context()
+ {
+ base.Context();
+ LoggingExtensions.Logging.Log.InitializeWith<Log4NetLog>();
+ }
+
+ [Fact]
+ public void with_many_iterations_of_getting_a_logger()
+ {
+ stopwatch.Reset();
+ stopwatch.Start();
+ for (int i = 0; i < NumberOfIterations; i++)
+ {
+ Logging.Log.GetLoggerFor(typeof(Log4NetPerformanceSpecsBase).FullName);
+ }
+ stopwatch.Stop();
+ Console.WriteLine("Static Log Gateway LogManager calls over '{0}' iterations took approximately '{1}' milliseconds. This is on average '{2}' ticks per call.", NumberOfIterations, stopwatch.ElapsedMilliseconds, (stopwatch.ElapsedTicks / NumberOfIterations));
+ }
+
+ [Fact]
+ public void with_many_iterations_of_logging()
+ {
+ var logger = Logging.Log.GetLoggerFor(typeof(Log4NetPerformanceSpecsBase).FullName);
+ stopwatch.Reset();
+ stopwatch.Start();
+ for (int i = 0; i < NumberOfIterations; i++)
+ {
+ logger.Debug("Here's a message");
+ }
+ stopwatch.Stop();
+ Console.WriteLine("Static Log Gateway Logging calls over '{0}' iterations took approximately '{1}' milliseconds. This is on average '{2}' ticks per call.", NumberOfIterations, stopwatch.ElapsedMilliseconds, (stopwatch.ElapsedTicks / NumberOfIterations));
+ }
+
+ [Fact]
+ public void with_many_iterations_of_logging_with_func()
+ {
+ var logger = Logging.Log.GetLoggerFor(typeof(Log4NetPerformanceSpecsBase).FullName);
+ stopwatch.Reset();
+ stopwatch.Start();
+ for (int i = 0; i < NumberOfIterations; i++)
+ {
+ logger.Debug(()=>"Here's a message");
+ }
+ stopwatch.Stop();
+ Console.WriteLine("Static Log Gateway Logging calls with deferred execution over '{0}' iterations took approximately '{1}' milliseconds. This is on average '{2}' ticks per call.", NumberOfIterations, stopwatch.ElapsedMilliseconds, (stopwatch.ElapsedTicks / NumberOfIterations));
+ }
+ }
+
+ public class when_using_logging_extension_to_compare_performance : Log4NetPerformanceSpecsBase
+ {
+ public override void Context()
+ {
+ base.Context();
+ LoggingExtensions.Logging.Log.InitializeWith<Log4NetLog>();
+ }
+
+ [Fact]
+ public void with_many_iterations_of_logging()
+ {
+ stopwatch.Reset();
+ stopwatch.Start();
+ for (int i = 0; i < NumberOfIterations; i++)
+ {
+ this.Log().Debug("Here's a message");
+ }
+ stopwatch.Stop();
+ Console.WriteLine("this.Log Logging calls over '{0}' iterations took approximately '{1}' milliseconds. This is on average '{2}' ticks per call.", NumberOfIterations, stopwatch.ElapsedMilliseconds, (stopwatch.ElapsedTicks / NumberOfIterations));
+ }
+
+ [Fact]
+ public void with_many_iterations_of_logging_with_func()
+ {
+ stopwatch.Reset();
+ stopwatch.Start();
+ for (int i = 0; i < NumberOfIterations; i++)
+ {
+ this.Log().Debug(()=>"Here's a message");
+ }
+ stopwatch.Stop();
+ Console.WriteLine("this.Log Logging calls with deferred execution over '{0}' iterations took approximately '{1}' milliseconds. This is on average '{2}' ticks per call.", NumberOfIterations, stopwatch.ElapsedMilliseconds,(stopwatch.ElapsedTicks / NumberOfIterations));
+ }
+ }
+ }
+}
View
36 LoggingExtensions.Tests/Properties/AssemblyInfo.cs
@@ -0,0 +1,36 @@
+using System.Reflection;
+using System.Runtime.CompilerServices;
+using System.Runtime.InteropServices;
+
+// General Information about an assembly is controlled through the following
+// set of attributes. Change these attribute values to modify the information
+// associated with an assembly.
+[assembly: AssemblyTitle("LoggingExtensions.Tests")]
+[assembly: AssemblyDescription("")]
+[assembly: AssemblyConfiguration("")]
+[assembly: AssemblyCompany("")]
+[assembly: AssemblyProduct("LoggingExtensions.Tests")]
+[assembly: AssemblyCopyright("Copyright © 2012")]
+[assembly: AssemblyTrademark("")]
+[assembly: AssemblyCulture("")]
+
+// Setting ComVisible to false makes the types in this assembly not visible
+// to COM components. If you need to access a type in this assembly from
+// COM, set the ComVisible attribute to true on that type.
+[assembly: ComVisible(false)]
+
+// The following GUID is for the ID of the typelib if this project is exposed to COM
+[assembly: Guid("2e047a01-6afa-4c74-9cd0-a25b1f5705c1")]
+
+// Version information for an assembly consists of the following four values:
+//
+// Major Version
+// Minor Version
+// Build Number
+// Revision
+//
+// You can specify all the values or you can default the Build and Revision Numbers
+// by using the '*' as shown below:
+// [assembly: AssemblyVersion("1.0.*")]
+[assembly: AssemblyVersion("1.0.0.0")]
+[assembly: AssemblyFileVersion("1.0.0.0")]
View
66 LoggingExtensions.Tests/TinySpec.cs
@@ -0,0 +1,66 @@
+// ==============================================================================
+//
+// Fervent Coder Copyright © 2011 - Released under the Apache 2.0 License
+//
+// Copyright 2007-2008 The Apache Software Foundation.
+//
+// Licensed 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 LoggingExtensions.Tests
+{
+ using System;
+ //using Logging;
+ using Moq;
+ using NUnit.Framework;
+
+ [TestFixture]
+ public abstract class TinySpec
+ {
+ public MockLogger Logger { get; set; }
+
+ [TestFixtureSetUp]
+ public void Setup()
+ {
+ Logger = new LoggingExtensions.Moq.MockLogger();
+ LoggingExtensions.Logging.Log.InitializeWith(Logger);
+
+ Context();
+ Because();
+ }
+
+ public abstract void Context();
+
+ public abstract void Because();
+
+ [TestFixtureTearDown]
+ public void TearDown()
+ {
+ AfterObservations();
+ }
+
+ public virtual void AfterObservations() {}
+ }
+
+ public class ObservationAttribute : TestAttribute {}
+ public class FactAttribute : TestAttribute {}
+
+ public class ConcernForAttribute : Attribute
+ {
+ public string Name { get; set; }
+
+ public ConcernForAttribute(string name)
+ {
+ Name = name;
+ }
+ }
+
+}
View
9 LoggingExtensions.Tests/packages.config
@@ -0,0 +1,9 @@
+<?xml version="1.0" encoding="utf-8"?>
+<packages>
+ <package id="log4net" version="1.2.10" targetFramework="net40" allowedVersions="[1.2.10]" />
+ <package id="Moq" version="4.0.10827" targetFramework="net40" />
+ <package id="NLog" version="2.0.0.2000" targetFramework="net40" />
+ <package id="NUnit" version="2.5.10.11092" targetFramework="net40" />
+ <package id="Should" version="1.1.12.0" targetFramework="net40" />
+ <package id="TinySpec.NUnit" version="0.9.5" targetFramework="net40" />
+</packages>
View
56 LoggingExtensions.log4net.Sample.VB/LogExtensions.vb
@@ -0,0 +1,56 @@
+' ==============================================================================
+'
+' RealDimensions Software, LLC - Copyright © 2012 - Present - Released under the Apache 2.0 License
+'
+' Copyright 2007-2008 The Apache Software Foundation.
+'
+' Licensed 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.
+' ==============================================================================
+
+Imports System.Collections.Concurrent
+Imports System.Runtime.CompilerServices
+Imports LoggingExtensions.Logging
+
+''' <summary>
+''' Extensions to help make logging awesome - this should be installed into the root namespace of your application
+''' </summary>
+Public Module LogExtensions
+
+ ''' <summary>
+ ''' Concurrent dictionary that ensures only one instance of a logger for a type.
+ ''' </summary>
+ Private ReadOnly _dictionary As ConcurrentDictionary(Of String, ILog) = New ConcurrentDictionary(Of String, ILog)
+
+ ''' <summary>
+ ''' Gets the logger for <see cref="T"/>.
+ ''' </summary>
+ ''' <typeparam name="T"></typeparam>
+ ''' <param name="type">The type to get the logger for.</param>
+ ''' <returns>Instance of a logger for the object.</returns>
+ <Extension()>
+ Public Function Log(Of T)(type As T) As ILog
+ Dim objectName As String = GetType(T).FullName
+
+ Return Log(objectName)
+ End Function
+
+ ''' <summary>
+ ''' Gets the logger for the specified object name.
+ ''' </summary>
+ ''' <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>
+ ''' <returns>Instance of a logger for the object.</returns>
+ <Extension()>
+ Public Function Log(objectName As String) As ILog
+ Return _dictionary.GetOrAdd(objectName, Function(name) (LoggingExtensions.Logging.Log.GetLoggerFor(name)))
+ End Function
+
+End Module
View
134 LoggingExtensions.log4net.Sample.VB/LoggingExtensions.log4net.VB.Sample.vbproj
@@ -0,0 +1,134 @@
+<?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)' == '' ">x86</Platform>
+ <ProductVersion>
+ </ProductVersion>
+ <SchemaVersion>
+ </SchemaVersion>
+ <ProjectGuid>{2CD8FB1B-5CAD-4FAA-9172-DACF26B04A74}</ProjectGuid>
+ <OutputType>Exe</OutputType>
+ <StartupObject>SampleRun</StartupObject>
+ <RootNamespace>
+ </RootNamespace>
+ <AssemblyName>this.Log-log4net.Sample.VB</AssemblyName>
+ <FileAlignment>512</FileAlignment>
+ <MyType>Console</MyType>
+ <TargetFrameworkVersion>v4.0</TargetFrameworkVersion>
+ <TargetFrameworkProfile>
+ </TargetFrameworkProfile>
+ <PublishUrl>publish\</PublishUrl>
+ <Install>true</Install>
+ <InstallFrom>Disk</InstallFrom>
+ <UpdateEnabled>false</UpdateEnabled>
+ <UpdateMode>Foreground</UpdateMode>
+ <UpdateInterval>7</UpdateInterval>
+ <UpdateIntervalUnits>Days</UpdateIntervalUnits>
+ <UpdatePeriodically>false</UpdatePeriodically>
+ <UpdateRequired>false</UpdateRequired>
+ <MapFileExtensions>true</MapFileExtensions>
+ <ApplicationRevision>0</ApplicationRevision>
+ <ApplicationVersion>1.0.0.%2a</ApplicationVersion>
+ <IsWebBootstrapper>false</IsWebBootstrapper>
+ <UseApplicationTrust>false</UseApplicationTrust>
+ <BootstrapperEnabled>true</BootstrapperEnabled>
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|x86' ">
+ <PlatformTarget>x86</PlatformTarget>
+ <DebugSymbols>true</DebugSymbols>
+ <DebugType>full</DebugType>
+ <DefineDebug>true</DefineDebug>
+ <DefineTrace>true</DefineTrace>
+ <OutputPath>bin\Debug\</OutputPath>
+ <DocumentationFile>this.Log-log4net.Sample.VB.xml</DocumentationFile>
+ <NoWarn>
+ </NoWarn>
+ <WarningsAsErrors>41998,41999,42004,42016,42017,42018,42019,42020,42021,42022,42024,42025,42026,42029,42030,42031,42032,42036,42099,42104,42105,42106,42107,42108,42109,42353,42354,42355</WarningsAsErrors>
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|x86' ">
+ <PlatformTarget>x86</PlatformTarget>
+ <DebugType>pdbonly</DebugType>
+ <DefineDebug>false</DefineDebug>
+ <DefineTrace>true</DefineTrace>
+ <Optimize>true</Optimize>
+ <OutputPath>bin\Release\</OutputPath>
+ <DocumentationFile>this.Log-log4net.Sample.VB.xml</DocumentationFile>
+ <NoWarn>
+ </NoWarn>
+ <WarningsAsErrors>41998,41999,42004,42016,42017,42018,42019,42020,42021,42022,42024,42025,42026,42029,42030,42031,42032,42036,42099,42104,42105,42106,42107,42108,42109,42353,42354,42355</WarningsAsErrors>
+ </PropertyGroup>
+ <PropertyGroup>
+ <OptionExplicit>On</OptionExplicit>
+ </PropertyGroup>
+ <PropertyGroup>
+ <OptionCompare>Binary</OptionCompare>
+ </PropertyGroup>
+ <PropertyGroup>
+ <OptionStrict>On</OptionStrict>
+ </PropertyGroup>
+ <PropertyGroup>
+ <OptionInfer>On</OptionInfer>
+ </PropertyGroup>
+ <PropertyGroup />
+ <ItemGroup>
+ <Reference Include="log4net, Version=1.2.10.0, Culture=neutral, PublicKeyToken=1b44e1d426115821, processorArchitecture=MSIL">
+ <Private>True</Private>
+ <HintPath>..\packages\log4net.1.2.10\lib\2.0\log4net.dll</HintPath>
+ </Reference>
+ <Reference Include="System" />
+ <Reference Include="System.Data" />
+ <Reference Include="System.Deployment" />
+ <Reference Include="System.Xml" />
+ <Reference Include="System.Core" />
+ <Reference Include="System.Xml.Linq" />
+ <Reference Include="System.Data.DataSetExtensions" />
+ <Reference Include="this.Log, Version=0.0.1.0, Culture=neutral, processorArchitecture=MSIL">
+ <HintPath>..\packages\this.Log.0.0.1.0\lib\net40\this.Log.dll</HintPath>
+ </Reference>
+ <Reference Include="this.Log-log4net, Version=0.0.1.0, Culture=neutral, processorArchitecture=MSIL">
+ <HintPath>..\packages\this.Log-log4net.0.0.1.0\lib\this.Log-log4net.dll</HintPath>
+ </Reference>
+ </ItemGroup>
+ <ItemGroup>
+ <Compile Include="LogExtensions.vb" />
+ <Compile Include="My Project\AssemblyInfo.vb" />
+ <Compile Include="SampleRun.vb" />
+ <Compile Include="TestClass.vb" />
+ </ItemGroup>
+ <ItemGroup>
+ <None Include="app.config" />
+ <None Include="packages.config" />
+ <None Include="this.Log-log4net.Sample.VB.nuspec" />
+ </ItemGroup>
+ <ItemGroup>
+ <BootstrapperPackage Include=".NETFramework,Version=v4.0,Profile=Client">
+ <Visible>False</Visible>
+ <ProductName>Microsoft .NET Framework 4 Client Profile %28x86 and x64%29</ProductName>
+ <Install>true</Install>
+ </BootstrapperPackage>
+ <BootstrapperPackage Include="Microsoft.Net.Client.3.5">
+ <Visible>False</Visible>
+ <ProductName>.NET Framework 3.5 SP1 Client Profile</ProductName>
+ <Install>false</Install>
+ </BootstrapperPackage>
+ <BootstrapperPackage Include="Microsoft.Net.Framework.3.5.SP1">
+ <Visible>False</Visible>
+ <ProductName>.NET Framework 3.5 SP1</ProductName>
+ <Install>false</Install>
+ </BootstrapperPackage>
+ <BootstrapperPackage Include="Microsoft.Windows.Installer.3.1">
+ <Visible>False</Visible>
+ <ProductName>Windows Installer 3.1</ProductName>
+ <Install>true</Install>
+ </BootstrapperPackage>
+ </ItemGroup>
+ <Import Project="$(MSBuildToolsPath)\Microsoft.VisualBasic.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
35 LoggingExtensions.log4net.Sample.VB/My Project/AssemblyInfo.vb
@@ -0,0 +1,35 @@
+Imports System
+Imports System.Reflection
+Imports System.Runtime.InteropServices
+
+' General Information about an assembly is controlled through the following
+' set of attributes. Change these attribute values to modify the information
+' associated with an assembly.
+
+' Review the values of the assembly attributes
+
+<Assembly: AssemblyTitle("this.Log-log4net.Sample.VB")>
+<Assembly: AssemblyDescription("")>
+<Assembly: AssemblyCompany("RealDimensions Software, LLC")>
+<Assembly: AssemblyProduct("this.Log-log4net.Sample.VB")>
+<Assembly: AssemblyCopyright("Copyright © 2012 RealDimensions Software, LLC")>
+<Assembly: AssemblyTrademark("")>
+
+<Assembly: ComVisible(False)>
+
+'The following GUID is for the ID of the typelib if this project is exposed to COM
+<Assembly: Guid("e779a01c-5479-4156-8d66-a146a9566366")>
+
+' Version information for an assembly consists of the following four values:
+'
+' Major Version
+' Minor Version
+' Build Number
+' Revision
+'
+' You can specify all the values or you can default the Build and Revision Numbers
+' by using the '*' as shown below:
+' <Assembly: AssemblyVersion("1.0.*")>
+
+<Assembly: AssemblyVersion("0.0.1.0")>
+<Assembly: AssemblyFileVersion("0.0.1.0")>
View
13 LoggingExtensions.log4net.Sample.VB/SampleRun.vb
@@ -0,0 +1,13 @@
+Public Module SampleRun
+
+ ''' <summary>
+ ''' The main entry point for the application.
+ ''' </summary>
+ Public Sub Main(ByVal args() As String)
+ LoggingExtensions.Logging.Log.InitializeWith(Of LoggingExtensions.log4net.Log4NetLog)()
+
+ Dim test As New TestClass()
+ test.Noop()
+ End Sub
+
+End Module
View
13 LoggingExtensions.log4net.Sample.VB/SampleRun.vb.pp
@@ -0,0 +1,13 @@
+Public Module SampleRun
+
+ ''' <summary>
+ ''' The main entry point for the application.
+ ''' </summary>
+ Public Sub Main(ByVal args() As String)
+ LoggingExtensions.Logging.Log.InitializeWith(Of LoggingExtensions.log4net.Log4NetLog)()
+
+ Dim test As New TestClass()
+ test.Noop()
+ End Sub
+
+End Module
View
7 LoggingExtensions.log4net.Sample.VB/TestClass.vb
@@ -0,0 +1,7 @@
+Public Class TestClass
+ Public Sub Noop()
+ Me.Log().Debug("yes")
+
+ '"TestClass".Log().Debug("Yep")
+ End Sub
+End Class
View
7 LoggingExtensions.log4net.Sample.VB/TestClass.vb.pp
@@ -0,0 +1,7 @@
+Public Class TestClass
+ Public Sub Noop()
+ Me.Log().Debug("yes")
+
+ '"TestClass".Log().Debug("Yep")
+ End Sub
+End Class
View
69 LoggingExtensions.log4net.Sample.VB/app.config
@@ -0,0 +1,69 @@
+<?xml version="1.0"?>
+<configuration>
+ <configSections>
+ <section name="log4net" type="log4net.Config.Log4NetConfigurationSectionHandler, log4net"/>
+ </configSections>
+ <log4net>
+ <appender name="ColoredConsoleAppender" type="log4net.Appender.ColoredConsoleAppender">
+ <mapping>
+ <level value="ERROR"/>
+ <foreColor value="White, HighIntensity"/>
+ <backColor value="Red"/>
+ </mapping>
+ <mapping>
+ <level value="WARN"/>
+ <foreColor value="Red"/>
+ <backColor value="Yellow, HighIntensity"/>
+ </mapping>
+ <mapping>
+ <level value="INFO"/>
+ <foreColor value="Green, HighIntensity"/>
+ </mapping>
+ <mapping>
+ <level value="DEBUG"/>
+ <foreColor value="Blue, HighIntensity"/>
+ </mapping>
+ <layout type="log4net.Layout.PatternLayout">
+ <conversionPattern value="%message%newline"/>
+ </layout>
+ </appender>
+ <appender name="RollingLogFileAppender" type="log4net.Appender.RollingFileAppender">
+ <file value=".\logs\this.Log-log4net.Sample.log"/>
+ <appendToFile value="true"/>
+ <maxSizeRollBackups value="10"/>
+ <maximumFileSize value="1MB"/>
+ <rollingStyle value="Size"/>
+ <staticLogFileName value="true"/>
+ <layout type="log4net.Layout.PatternLayout">
+ <!--<header value="[Header]&#13;&#10;" />-->
+ <!--<footer value="[Footer]&#13;&#10;" />-->
+ <!--<conversionPattern value="%date [%thread] %-5level %logger [%ndc] - %message%newline" />-->
+ <conversionPattern value="%date %thread [%-5level] - %message%newline"/>
+ </layout>
+ </appender>
+ <appender name="ErrorSmtpAppender" type="log4net.Appender.SmtpAppender">
+ <to value="noone@noreply.org"/>
+ <from value="this.Log.sample@noreply.org"/>
+ <subject value="this.Log Sample Console Errors - LOCAL DEBUG"/>
+ <smtpHost value="localhost"/>
+ <bufferSize value="2"/>
+ <lossy value="true"/>
+ <evaluator type="log4net.Core.LevelEvaluator">
+ <threshold value="ERROR"/>
+ </evaluator>
+ <layout type="log4net.Layout.PatternLayout">
+ <conversionPattern value="%newline%date [%thread] %-5level %logger - %message%newline"/>
+ <!--<conversionPattern value="%newline%date [%thread] %-5level %logger [%property{NDC}] - %message%newline" />-->
+ </layout>
+ </appender>
+ <root>
+ <level value="DEBUG"/>
+ <appender-ref ref="ColoredConsoleAppender"/>
+ <appender-ref ref="RollingLogFileAppender"/>
+ <appender-ref ref="ErrorSmtpAppender"/>
+ </root>
+ </log4net>
+ <startup>
+ <supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.0"/>
+ </startup>
+</configuration>
View
6 LoggingExtensions.log4net.Sample.VB/packages.config
@@ -0,0 +1,6 @@
+<?xml version="1.0" encoding="utf-8"?>
+<packages>
+ <package id="log4net" version="1.2.10" targetFramework="net40-Client" allowedVersions="[1.2.10]" />
+ <package id="this.Log" version="0.0.1.0" targetFramework="net40-Client" />
+ <package id="this.Log-log4net" version="0.0.1.0" targetFramework="net40-Client" />
+</packages>
View
25 LoggingExtensions.log4net.Sample.VB/this.Log-log4net.Sample.VB.nuspec
@@ -0,0 +1,25 @@
+<?xml version="1.0"?>
+<package >
+ <metadata>
+ <id>this.Log-log4net.Sample.VB</id>
+ <version>0.0.1.0</version>
+ <title>this.Log Logging Extension (log4net Plugin) SAMPLE for VB.NET</title>
+ <authors>RealDimensions Software, LLC</authors>
+ <owners>Rob Reynolds</owners>
+ <projectUrl>https://github.com/ferventcoder/this.Log</projectUrl>
+ <licenseUrl>https://raw.github.com/ferventcoder/this.Log/master/LICENSE</licenseUrl>
+ <requireLicenseAcceptance>false</requireLicenseAcceptance>
+ <summary>this.Log-log4net.Sample - this.Log logging extension using log4net</summary>
+ <description>this.Log-log4net.Sample is a sample of how to use the log4net plugin to this.Log logging extension.</description>
+ <releaseNotes></releaseNotes>
+ <copyright>Copyright 2012</copyright>
+ <tags>logging log this.Log log4net sample</tags>
+ <dependencies>
+ <dependency id="this.Log-log4net" version="0.0.1.0" />
+ </dependencies>
+ </metadata>
+ <files>
+ <file src="SampleRun.vb.pp" target="content" />
+ <file src="TestClass.vb.pp" target="content" />
+ </files>
+</package>
View
69 LoggingExtensions.log4net.Sample/App.config
@@ -0,0 +1,69 @@
+<?xml version="1.0"?>
+<configuration>
+ <configSections>
+ <section name="log4net" type="log4net.Config.Log4NetConfigurationSectionHandler, log4net"/>
+ </configSections>
+ <log4net>
+ <appender name="ColoredConsoleAppender" type="log4net.Appender.ColoredConsoleAppender">
+ <mapping>
+ <level value="ERROR"/>
+ <foreColor value="White, HighIntensity"/>
+ <backColor value="Red"/>
+ </mapping>
+ <mapping>
+ <level value="WARN"/>
+ <foreColor value="Red"/>
+ <backColor value="Yellow, HighIntensity"/>
+ </mapping>
+ <mapping>
+ <level value="INFO"/>
+ <foreColor value="Green, HighIntensity"/>
+ </mapping>
+ <mapping>
+ <level value="DEBUG"/>
+ <foreColor value="Blue, HighIntensity"/>
+ </mapping>
+ <layout type="log4net.Layout.PatternLayout">
+ <conversionPattern value="%message%newline"/>
+ </layout>
+ </appender>
+ <appender name="RollingLogFileAppender" type="log4net.Appender.RollingFileAppender">
+ <file value=".\logs\this.Log-log4net.Sample.log"/>
+ <appendToFile value="true"/>
+ <maxSizeRollBackups value="10"/>
+ <maximumFileSize value="1MB"/>
+ <rollingStyle value="Size"/>
+ <staticLogFileName value="true"/>
+ <layout type="log4net.Layout.PatternLayout">
+ <!--<header value="[Header]&#13;&#10;" />-->
+ <!--<footer value="[Footer]&#13;&#10;" />-->
+ <!--<conversionPattern value="%date [%thread] %-5level %logger [%ndc] - %message%newline" />-->
+ <conversionPattern value="%date %thread [%-5level] - %message%newline"/>
+ </layout>
+ </appender>
+ <appender name="ErrorSmtpAppender" type="log4net.Appender.SmtpAppender">
+ <to value="noone@noreply.org"/>
+ <from value="this.Log.sample@noreply.org"/>
+ <subject value="this.Log Sample Console Errors - LOCAL DEBUG"/>
+ <smtpHost value="localhost"/>
+ <bufferSize value="2"/>
+ <lossy value="true"/>
+ <evaluator type="log4net.Core.LevelEvaluator">
+ <threshold value="ERROR"/>
+ </evaluator>
+ <layout type="log4net.Layout.PatternLayout">
+ <conversionPattern value="%newline%date [%thread] %-5level %logger - %message%newline"/>
+ <!--<conversionPattern value="%newline%date [%thread] %-5level %logger [%property{NDC}] - %message%newline" />-->
+ </layout>
+ </appender>
+ <root>
+ <level value="DEBUG"/>
+ <appender-ref ref="ColoredConsoleAppender"/>
+ <appender-ref ref="RollingLogFileAppender"/>
+ <appender-ref ref="ErrorSmtpAppender"/>
+ </root>
+ </log4net>
+ <startup>
+ <supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.0"/>
+ </startup>
+</configuration>
View
56 LoggingExtensions.log4net.Sample/LogExtensions.cs
@@ -0,0 +1,56 @@
+// ==============================================================================
+//
+// RealDimensions Software, LLC - Copyright © 2012 - Present - Released under the Apache 2.0 License
+//
+// Copyright 2007-2008 The Apache Software Foundation.
+//
+// Licensed 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 LoggingExtensions.Sample.log4net
+{
+ using System.Collections.Concurrent;
+ using LoggingExtensions.Logging;
+
+ /// <summary>
+ /// Extensions to help make logging awesome - this should be installed into the root namespace of your application
+ /// </summary>
+ public static class LogExtensions
+ {
+ /// <summary>
+ /// Concurrent dictionary that ensures only one instance of a logger for a type.
+ /// </summary>
+ private static readonly ConcurrentDictionary<string, ILog> _dictionary = new ConcurrentDictionary<string, ILog>();
+
+ /// <summary>
+ /// Gets the logger for <see cref="T"/>.
+ /// </summary>
+ /// <typeparam name="T"></typeparam>
+ /// <param name="type">The type to get the logger for.</param>
+ /// <returns>Instance of a logger for the object.</returns>
+ public static ILog Log<T>(this T type)
+ {
+ string objectName = typeof (T).FullName;
+ return Log(objectName);
+ }
+
+ /// <summary>
+ /// Gets the logger for the specified object name.
+ /// </summary>
+ /// <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>
+ /// <returns>Instance of a logger for the object.</returns>
+ public static ILog Log(this string objectName)
+ {
+ return _dictionary.GetOrAdd(objectName, LoggingExtensions.Logging.Log.GetLoggerFor);
+ }
+ }
+}
View
112 LoggingExtensions.log4net.Sample/LoggingExtensions.log4net.Sample.csproj
@@ -0,0 +1,112 @@
+<?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)' == '' ">x86</Platform>
+ <ProductVersion>8.0.30703</ProductVersion>
+ <SchemaVersion>2.0</SchemaVersion>
+ <ProjectGuid>{943E3DDC-8460-4DCF-A453-E824BC64F1C1}</ProjectGuid>
+ <OutputType>Exe</OutputType>
+ <AppDesignerFolder>Properties</AppDesignerFolder>
+ <RootNamespace>LoggingExtensions.Sample.log4net</RootNamespace>
+ <AssemblyName>this.Log-log4net.Sample</AssemblyName>
+ <TargetFrameworkVersion>v4.0</TargetFrameworkVersion>
+ <TargetFrameworkProfile>
+ </TargetFrameworkProfile>
+ <FileAlignment>512</FileAlignment>
+ <PublishUrl>publish\</PublishUrl>
+ <Install>true</Install>
+ <InstallFrom>Disk</InstallFrom>
+ <UpdateEnabled>false</UpdateEnabled>
+ <UpdateMode>Foreground</UpdateMode>
+ <UpdateInterval>7</UpdateInterval>
+ <UpdateIntervalUnits>Days</UpdateIntervalUnits>
+ <UpdatePeriodically>false</UpdatePeriodically>
+ <UpdateRequired>false</UpdateRequired>
+ <MapFileExtensions>true</MapFileExtensions>
+ <ApplicationRevision>0</ApplicationRevision>
+ <ApplicationVersion>1.0.0.%2a</ApplicationVersion>
+ <IsWebBootstrapper>false</IsWebBootstrapper>
+ <UseApplicationTrust>false</UseApplicationTrust>
+ <BootstrapperEnabled>true</BootstrapperEnabled>
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|x86' ">
+ <PlatformTarget>x86</PlatformTarget>
+ <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|x86' ">
+ <PlatformTarget>x86</PlatformTarget>
+ <DebugType>pdbonly</DebugType>
+ <Optimize>true</Optimize>
+ <OutputPath>bin\Release\</OutputPath>
+ <DefineConstants>TRACE</DefineConstants>
+ <ErrorReport>prompt</ErrorReport>
+ <WarningLevel>4</WarningLevel>
+ </PropertyGroup>
+ <PropertyGroup>
+ <StartupObject>LoggingExtensions.Sample.log4net.SampleRun</StartupObject>
+ </PropertyGroup>
+ <ItemGroup>
+ <Reference Include="log4net, Version=1.2.10.0, Culture=neutral, PublicKeyToken=1b44e1d426115821, processorArchitecture=MSIL">
+ <Private>True</Private>
+ <HintPath>..\packages\log4net.1.2.10\lib\2.0\log4net.dll</HintPath>
+ </Reference>
+ <Reference Include="System" />
+ <Reference Include="System.Core" />
+ <Reference Include="this.Log">
+ <HintPath>..\packages\this.Log.0.0.1.0\lib\net40\this.Log.dll</HintPath>
+ </Reference>
+ <Reference Include="this.Log-log4net, Version=0.0.1.0, Culture=neutral, processorArchitecture=MSIL">
+ <HintPath>..\packages\this.Log-log4net.0.0.1.0\lib\this.Log-log4net.dll</HintPath>
+ </Reference>
+ </ItemGroup>
+ <ItemGroup>
+ <Compile Include="SampleRun.cs">
+ <SubType>Code</SubType>
+ </Compile>
+ <Content Include="SampleRun.cs.pp" />
+ <Compile Include="LogExtensions.cs" />
+ <Compile Include="Properties\AssemblyInfo.cs" />
+ </ItemGroup>
+ <ItemGroup>
+ <None Include="App.config" />
+ <None Include="packages.config" />
+ <None Include="this.Log-log4net.Sample.nuspec" />
+ </ItemGroup>
+ <ItemGroup>
+ <BootstrapperPackage Include=".NETFramework,Version=v4.0">
+ <Visible>False</Visible>
+ <ProductName>Microsoft .NET Framework 4 %28x86 and x64%29</ProductName>
+ <Install>true</Install>
+ </BootstrapperPackage>