Skip to content

Commit

Permalink
More cleanup
Browse files Browse the repository at this point in the history
Tabs to spaces, typos, set assembly version
  • Loading branch information
Justin Greywolf committed May 19, 2021
1 parent 92cb2aa commit 1fd7284
Show file tree
Hide file tree
Showing 53 changed files with 1,102 additions and 1,075 deletions.
60 changes: 30 additions & 30 deletions src/ObjectPrinter.Log4Net.v1210/Log4NetObjectRenderer.cs
Original file line number Diff line number Diff line change
@@ -1,44 +1,44 @@
using System.IO;
using ObjectPrinter.Utilties;
using ObjectPrinter.Utilities;
using log4net.ObjectRenderer;

namespace ObjectPrinter.Log4Net
{
/// <summary>
/// class used by log4net to render objects
/// </summary>
public class Log4NetObjectRenderer : IObjectRenderer
{
/// <summary></summary>
public void RenderObject(RendererMap rendererMap, object obj, TextWriter writer)
{
if (obj == null)
{
return;
}
public class Log4NetObjectRenderer : IObjectRenderer
{
/// <summary></summary>
public void RenderObject(RendererMap rendererMap, object obj, TextWriter writer)
{
if (obj == null)
{
return;
}

var objAsString = obj as string;
if (obj is string)
{
writer.Write(objAsString);
return;
}
var objAsString = obj as string;
if (obj is string)
{
writer.Write(objAsString);
return;
}

if (obj is LazyString)
{
writer.Write(obj.ToString());
return;
}
if (obj is LazyString)
{
writer.Write(obj.ToString());
return;
}

var ns = obj.GetType().Namespace;
if (!string.IsNullOrEmpty(ns) && (ns.StartsWith("log4net") || ns.StartsWith("Common.Logging")))
{
//if we get a log4net object, log4net will expect us to call ToString to get the format
writer.Write(obj.ToString());
return;
}
var ns = obj.GetType().Namespace;
if (!string.IsNullOrEmpty(ns) && (ns.StartsWith("log4net") || ns.StartsWith("Common.Logging")))
{
//if we get a log4net object, log4net will expect us to call ToString to get the format
writer.Write(obj.ToString());
return;
}

obj.DumpTo(writer);
}
}
}
}
}
32 changes: 16 additions & 16 deletions src/ObjectPrinter.Log4Net.v1210/Log4NetTypeInspector.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,22 +3,22 @@

namespace ObjectPrinter.Log4Net
{
/// <summary>
/// returns the ToString() represenation for every object in the "log4net*" namespaces,
/// as log4net intended. all bow to log4net.
/// </summary>
public class Log4NetTypeInspector : ToStringTypeInspector
{
/// <summary>
/// returns the ToString() representation for every object in the "log4net*" namespaces,
/// as log4net intended.
/// </summary>
public class Log4NetTypeInspector : ToStringTypeInspector
{
///<summary></summary>
public Log4NetTypeInspector()
{
ShouldInspectType = NamespaceIsLog4Net;
}
public Log4NetTypeInspector()
{
ShouldInspectType = NamespaceIsLog4Net;
}

private static bool NamespaceIsLog4Net(object objectToInspect, Type typeOfObjectToInspect)
{
return typeOfObjectToInspect.Namespace != null
&& typeOfObjectToInspect.Namespace.StartsWith("log4net");
}
}
private static bool NamespaceIsLog4Net(object objectToInspect, Type typeOfObjectToInspect)
{
return typeOfObjectToInspect.Namespace != null
&& typeOfObjectToInspect.Namespace.StartsWith("log4net");
}
}
}
4 changes: 2 additions & 2 deletions src/ObjectPrinter.Log4Net.v1210/Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("ObjectPrinter.Log4Net.v1210")]
[assembly: AssemblyCopyright("Copyright © 2012")]
[assembly: AssemblyCopyright("Copyright © 2021")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]

Expand All @@ -30,4 +30,4 @@
//
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
[assembly: AssemblyVersion("1.2.*")]
[assembly: AssemblyVersion("2.0.*")]
2 changes: 1 addition & 1 deletion src/ObjectPrinter.Log4Net.v1211/Log4NetObjectRenderer.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
using System.IO;
using ObjectPrinter.Utilties;
using ObjectPrinter.Utilities;
using log4net.ObjectRenderer;

namespace ObjectPrinter.Log4Net
Expand Down
2 changes: 1 addition & 1 deletion src/ObjectPrinter.Log4Net.v1211/Log4NetTypeInspector.cs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ namespace ObjectPrinter.Log4Net
public class Log4NetTypeInspector : ToStringTypeInspector
{
///<summary></summary>
public Log4NetTypeInspector()
public Log4NetTypeInspector()
{
ShouldInspectType = NamespaceIsLog4Net;
}
Expand Down
4 changes: 2 additions & 2 deletions src/ObjectPrinter.Log4Net.v1211/Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("ObjectPrinter.Log4Net.v1211")]
[assembly: AssemblyCopyright("Copyright © 2012")]
[assembly: AssemblyCopyright("Copyright © 2021")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]

Expand All @@ -30,4 +30,4 @@
//
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
[assembly: AssemblyVersion("1.2.*")]
[assembly: AssemblyVersion("2.0.*")]
4 changes: 2 additions & 2 deletions src/ObjectPrinter.Log4Net.v1212/Log4NetObjectRenderer.cs
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
using System.IO;
using ObjectPrinter.Utilties;
using ObjectPrinter.Utilities;
using log4net.ObjectRenderer;

namespace ObjectPrinter.Log4Net
{
/// <summary>
/// class used by log4net to render objects
/// </summary>
public class Log4NetObjectRenderer : IObjectRenderer
public class Log4NetObjectRenderer : IObjectRenderer
{
/// <summary></summary>
public void RenderObject(RendererMap rendererMap, object obj, TextWriter writer)
Expand Down
2 changes: 1 addition & 1 deletion src/ObjectPrinter.Log4Net.v1212/Log4NetTypeInspector.cs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ namespace ObjectPrinter.Log4Net
public class Log4NetTypeInspector : ToStringTypeInspector
{
///<summary></summary>
public Log4NetTypeInspector()
public Log4NetTypeInspector()
{
ShouldInspectType = NamespaceIsLog4Net;
}
Expand Down
4 changes: 2 additions & 2 deletions src/ObjectPrinter.Log4Net.v1212/Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("ObjectPrinter.Log4Net.v1212")]
[assembly: AssemblyCopyright("Copyright © 2012")]
[assembly: AssemblyCopyright("Copyright © 2021")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]

Expand All @@ -30,4 +30,4 @@
//
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
[assembly: AssemblyVersion("1.2.*")]
[assembly: AssemblyVersion("2.0.*")]
4 changes: 2 additions & 2 deletions src/ObjectPrinter.Log4Net.v1213/Log4NetObjectRenderer.cs
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
using System.IO;
using ObjectPrinter.Utilties;
using ObjectPrinter.Utilities;
using log4net.ObjectRenderer;

namespace ObjectPrinter.Log4Net
{
/// <summary>
/// class used by log4net to render objects
/// </summary>
public class Log4NetObjectRenderer : IObjectRenderer
public class Log4NetObjectRenderer : IObjectRenderer
{
/// <summary></summary>
public void RenderObject(RendererMap rendererMap, object obj, TextWriter writer)
Expand Down
2 changes: 1 addition & 1 deletion src/ObjectPrinter.Log4Net.v1213/Log4NetTypeInspector.cs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ namespace ObjectPrinter.Log4Net
public class Log4NetTypeInspector : ToStringTypeInspector
{
///<summary></summary>
public Log4NetTypeInspector()
public Log4NetTypeInspector()
{
ShouldInspectType = NamespaceIsLog4Net;
}
Expand Down
4 changes: 2 additions & 2 deletions src/ObjectPrinter.Log4Net.v1213/Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("ObjectPrinter.Log4Net.v1213")]
[assembly: AssemblyCopyright("Copyright © 2012")]
[assembly: AssemblyCopyright("Copyright © 2021")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]

Expand All @@ -30,4 +30,4 @@
//
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
[assembly: AssemblyVersion("1.2.*")]
[assembly: AssemblyVersion("2.0.*")]
4 changes: 2 additions & 2 deletions src/ObjectPrinter.Log4Net.v1215/Log4NetObjectRenderer.cs
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
using System.IO;
using ObjectPrinter.Utilties;
using ObjectPrinter.Utilities;
using log4net.ObjectRenderer;

namespace ObjectPrinter.Log4Net
{
/// <summary>
/// class used by log4net to render objects
/// </summary>
public class Log4NetObjectRenderer : IObjectRenderer
public class Log4NetObjectRenderer : IObjectRenderer
{
/// <summary></summary>
public void RenderObject(RendererMap rendererMap, object obj, TextWriter writer)
Expand Down
28 changes: 14 additions & 14 deletions src/ObjectPrinter.Log4Net.v1215/Log4NetTypeInspector.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,21 +3,21 @@

namespace ObjectPrinter.Log4Net
{
/// <summary>
/// returns the ToString() representation for every object in the "log4net*" namespaces,
/// as log4net intended.
/// </summary>
public class Log4NetTypeInspector : ToStringTypeInspector
/// <summary>
/// returns the ToString() representation for every object in the "log4net*" namespaces,
/// as log4net intended.
/// </summary>
public class Log4NetTypeInspector : ToStringTypeInspector
{
///<summary></summary>
public Log4NetTypeInspector()
{
ShouldInspectType = NamespaceIsLog4Net;
}
public Log4NetTypeInspector()
{
ShouldInspectType = NamespaceIsLog4Net;
}

private static bool NamespaceIsLog4Net(object objectToInspect, Type typeOfObjectToInspect)
{
return typeOfObjectToInspect.IsTypeFromLoggingFramework();
}
}
private static bool NamespaceIsLog4Net(object objectToInspect, Type typeOfObjectToInspect)
{
return typeOfObjectToInspect.IsTypeFromLoggingFramework();
}
}
}
4 changes: 2 additions & 2 deletions src/ObjectPrinter.Log4Net.v1215/Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("ObjectPrinter.Log4Net.v1215")]
[assembly: AssemblyCopyright("Copyright © 2012")]
[assembly: AssemblyCopyright("Copyright © 2021")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]

Expand All @@ -30,4 +30,4 @@
//
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
[assembly: AssemblyVersion("1.2.*")]
[assembly: AssemblyVersion("2.0.*")]
24 changes: 12 additions & 12 deletions src/ObjectPrinter.Log4Net.v1215/TypeExtensions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,16 +6,16 @@ namespace ObjectPrinter.Log4Net
/// Extensions for types
/// </summary>
internal static class TypeExtensions
{
/// <summary>
/// Determines if a type belongs to log4net or Common.Logging
/// </summary>
internal static bool IsTypeFromLoggingFramework(this Type type)
{
var ns = type.Namespace;
return !string.IsNullOrEmpty(ns)
&& (ns.StartsWith("log4net")
|| ns.StartsWith("Common.Logging"));
}
}
{
/// <summary>
/// Determines if a type belongs to log4net or Common.Logging
/// </summary>
internal static bool IsTypeFromLoggingFramework(this Type type)
{
var ns = type.Namespace;
return !string.IsNullOrEmpty(ns)
&& (ns.StartsWith("log4net")
|| ns.StartsWith("Common.Logging"));
}
}
}
32 changes: 17 additions & 15 deletions src/ObjectPrinter.Specs/FuncsTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,26 +6,28 @@
namespace ObjectPrinter.Specs
{
[TestFixture]
public class FuncsTests
{
[Test]
public void IncludeNamespaces()
{
Funcs.IncludeNamespaces("System")(null, typeof(DateTime)).Should().Be(true);
Funcs.IncludeNamespaces("System")(null, typeof(TestAttribute)).Should().Be(false);
}
[Test]
public void ExcludeNamespaces()
{
Funcs.ExcludeNamespaces("System")(null, typeof(DateTime)).Should().Be(false);
Funcs.ExcludeNamespaces("System")(null, typeof(TestAttribute)).Should().Be(true);
}
public class FuncsTests
{
[Test]
public void IncludeNamespaces()
{
Funcs.IncludeNamespaces("System")(null, typeof(DateTime)).Should().Be(true);
Funcs.IncludeNamespaces("System")(null, typeof(TestAttribute)).Should().Be(false);
}

[Test]
public void ExcludeNamespaces()
{
Funcs.ExcludeNamespaces("System")(null, typeof(DateTime)).Should().Be(false);
Funcs.ExcludeNamespaces("System")(null, typeof(TestAttribute)).Should().Be(true);
}

[Test]
public void IncludeTypes()
{
var someObj = new TestAttribute();
Funcs.IncludeTypes(false, typeof(object))(someObj, someObj.GetType()).Should().BeFalse();
Funcs.IncludeTypes(true, typeof(object))(someObj, someObj.GetType()).Should().BeTrue();
}
}
}
}
2 changes: 1 addition & 1 deletion src/ObjectPrinter.Specs/IndentAwareTextWriterTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
using System.Text;
using FluentAssertions;
using NUnit.Framework;
using ObjectPrinter.Utilties;
using ObjectPrinter.Utilities;

namespace ObjectPrinter.Specs
{
Expand Down
Loading

0 comments on commit 1fd7284

Please sign in to comment.