Skip to content

Commit 71533cd

Browse files
author
mwatson
committed
Logging for sitecore
1 parent b8f620d commit 71533cd

File tree

9 files changed

+646
-1
lines changed

9 files changed

+646
-1
lines changed
11 KB
Binary file not shown.
Lines changed: 89 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,89 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
3+
<Choose>
4+
<When Condition="$(NCrunchOriginalSolutionDir) != '' And $(NCrunchOriginalSolutionDir) != '*Undefined*'">
5+
<PropertyGroup>
6+
<FodySolutionDir>$(NCrunchOriginalSolutionDir)</FodySolutionDir>
7+
</PropertyGroup>
8+
</When>
9+
<When Condition="$(SolutionDir) != '' And $(SolutionDir) != '*Undefined*'">
10+
<PropertyGroup>
11+
<FodySolutionDir>$(SolutionDir)</FodySolutionDir>
12+
</PropertyGroup>
13+
</When>
14+
<When Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">
15+
<PropertyGroup>
16+
<FodySolutionDir>$(MSBuildProjectDirectory)\..\</FodySolutionDir>
17+
</PropertyGroup>
18+
</When>
19+
</Choose>
20+
<Choose>
21+
<When Condition="$(KeyOriginatorFile) != '' And $(KeyOriginatorFile) != '*Undefined*'">
22+
<PropertyGroup>
23+
<FodyKeyFilePath>$(KeyOriginatorFile)</FodyKeyFilePath>
24+
</PropertyGroup>
25+
</When>
26+
<When Condition="$(AssemblyOriginatorKeyFile) != '' And $(AssemblyOriginatorKeyFile) != '*Undefined*'">
27+
<PropertyGroup>
28+
<FodyKeyFilePath>$(AssemblyOriginatorKeyFile)</FodyKeyFilePath>
29+
</PropertyGroup>
30+
</When>
31+
<Otherwise >
32+
<PropertyGroup>
33+
<FodyKeyFilePath></FodyKeyFilePath>
34+
</PropertyGroup>
35+
</Otherwise>
36+
</Choose>
37+
<PropertyGroup>
38+
<IntermediateDir>$(ProjectDir)$(IntermediateOutputPath)</IntermediateDir>
39+
<FodyMessageImportance Condition="$(FodyMessageImportance) == '' Or $(FodyMessageImportance) == '*Undefined*'">Low</FodyMessageImportance>
40+
<FodySignAssembly Condition="$(FodySignAssembly) == '' Or $(FodySignAssembly) == '*Undefined*'">$(SignAssembly)</FodySignAssembly>
41+
<FodyPath Condition="$(FodyPath) == '' Or $(FodyPath) == '*Undefined*'">$(MSBuildThisFileDirectory)</FodyPath>
42+
</PropertyGroup>
43+
<UsingTask
44+
TaskName="Fody.WeavingTask"
45+
AssemblyFile="$(FodyPath)\Fody.dll" />
46+
<Target
47+
AfterTargets="AfterCompile"
48+
Name="WinFodyTarget"
49+
Condition=" '$(OS)' == 'Windows_NT'">
50+
51+
<Fody.WeavingTask
52+
AssemblyPath="@(IntermediateAssembly)"
53+
IntermediateDir="$(IntermediateDir)"
54+
KeyFilePath="$(FodyKeyFilePath)"
55+
MessageImportance="$(FodyMessageImportance)"
56+
ProjectDirectory="$(ProjectDir)"
57+
SolutionDir="$(FodySolutionDir)"
58+
References="@(ReferencePath)"
59+
SignAssembly="$(FodySignAssembly)"
60+
ReferenceCopyLocalPaths="@(ReferenceCopyLocalPaths)"
61+
DefineConstants="$(DefineConstants)"
62+
/>
63+
</Target>
64+
65+
<Target
66+
AfterTargets="AfterBuild"
67+
Name="NonWinFodyTarget"
68+
Condition=" '$(OS)' != 'Windows_NT'">
69+
<Fody.WeavingTask
70+
AssemblyPath="$(TargetPath)"
71+
IntermediateDir="$(IntermediateDir)"
72+
KeyFilePath="$(FodyKeyFilePath)"
73+
MessageImportance="$(FodyMessageImportance)"
74+
ProjectDirectory="$(ProjectDir)"
75+
SolutionDir="$(FodySolutionDir)"
76+
References="@(ReferencePath)"
77+
SignAssembly="$(FodySignAssembly)"
78+
ReferenceCopyLocalPaths="$(ReferenceCopyLocalPaths)"
79+
DefineConstants="$(DefineConstants)"
80+
/>
81+
</Target>
82+
83+
84+
<!--Support for ncrunch-->
85+
<ItemGroup>
86+
<None Include="$(FodyPath)\*.*" />
87+
</ItemGroup>
88+
89+
</Project>
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<Weavers>
3+
<Costura ExcludeAssemblies="StackifyLib|Newtonsoft.Json|log4net"/>
4+
<Costura/>
5+
</Weavers>
Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
using System;
2+
using StackifyLib.Models;
3+
using log4net;
4+
5+
namespace StackifyLib
6+
{
7+
public static class Extensions
8+
{
9+
private static LogMessage GetMessage(string message, object debugData)
10+
{
11+
return new LogMessage() { message = message, json = debugData };
12+
}
13+
14+
public static void Debug(this ILog log, string message, object debugData)
15+
{
16+
log.Debug(GetMessage(message, debugData));
17+
}
18+
19+
public static void Info(this ILog log, string message, object debugData)
20+
{
21+
log.Info(GetMessage(message, debugData));
22+
}
23+
24+
public static void Warn(this ILog log, string message, object debugData)
25+
{
26+
log.Warn(GetMessage(message, debugData));
27+
}
28+
29+
public static void Warn(this ILog log, string message, object debugData, Exception exception)
30+
{
31+
log.Warn(GetMessage(message, debugData), exception);
32+
}
33+
34+
public static void Error(this ILog log, string message, object debugData)
35+
{
36+
log.Error(GetMessage(message, debugData));
37+
}
38+
39+
public static void Error(this ILog log, string message, object debugData, Exception exception)
40+
{
41+
log.Error(GetMessage(message, debugData), exception);
42+
}
43+
44+
public static void Fatal(this ILog log, string message, object debugData)
45+
{
46+
log.Fatal(GetMessage(message, debugData));
47+
}
48+
49+
public static void Fatal(this ILog log, string message, object debugData, Exception exception)
50+
{
51+
log.Fatal(GetMessage(message, debugData), exception);
52+
}
53+
}
54+
}
Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
using System.Reflection;
2+
using System.Runtime.CompilerServices;
3+
using System.Runtime.InteropServices;
4+
5+
// General Information about an assembly is controlled through the following
6+
// set of attributes. Change these attribute values to modify the information
7+
// associated with an assembly.
8+
[assembly: AssemblyTitle("StackifyLib.log4net.Sitecore")]
9+
[assembly: AssemblyDescription("")]
10+
[assembly: AssemblyConfiguration("")]
11+
[assembly: AssemblyCompany("")]
12+
[assembly: AssemblyProduct("StackifyLib.log4net.Sitecore")]
13+
[assembly: AssemblyCopyright("Copyright © 2015")]
14+
[assembly: AssemblyTrademark("")]
15+
[assembly: AssemblyCulture("")]
16+
17+
// Setting ComVisible to false makes the types in this assembly not visible
18+
// to COM components. If you need to access a type in this assembly from
19+
// COM, set the ComVisible attribute to true on that type.
20+
[assembly: ComVisible(false)]
21+
22+
// The following GUID is for the ID of the typelib if this project is exposed to COM
23+
[assembly: Guid("2963dd01-d67d-4666-b21a-f0d627629535")]
24+
25+
// Version information for an assembly consists of the following four values:
26+
//
27+
// Major Version
28+
// Minor Version
29+
// Build Number
30+
// Revision
31+
//
32+
// You can specify all the values or you can default the Build and Revision Numbers
33+
// by using the '*' as shown below:
34+
// [assembly: AssemblyVersion("1.0.*")]
35+
[assembly: AssemblyVersion("1.17.*")]
36+
[assembly: AssemblyFileVersion("1.17.*")]

0 commit comments

Comments
 (0)