forked from serilog/serilog
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add support for reference to public static properties in settings
as a value for parameters, using the syntax `NameSpace.To.ConcreteType::StaticProperty, AssemblyName`
- Loading branch information
Thibaud DESODT
committed
Nov 17, 2017
1 parent
f0d5d29
commit a20dce5
Showing
13 changed files
with
282 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,5 @@ | ||
namespace Serilog.Tests.Support | ||
{ | ||
|
||
public abstract class DummyAbstractClass | ||
{ | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
using TestDummies.Console.Themes; | ||
|
||
namespace Serilog.Tests.Support | ||
{ | ||
class CustomConsoleTheme : ConsoleTheme | ||
{ | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
| ||
namespace Serilog.Tests.Support | ||
{ | ||
public interface IAmAnInterface | ||
{ | ||
|
||
} | ||
|
||
public abstract class AnAbstractClass | ||
{ | ||
|
||
} | ||
|
||
class ConcreteImpl : AnAbstractClass, IAmAnInterface | ||
{ | ||
ConcreteImpl() | ||
{ | ||
|
||
} | ||
|
||
public static ConcreteImpl Instance { get; } = new ConcreteImpl(); | ||
} | ||
|
||
public class ClassWithStaticAccessors | ||
{ | ||
public static string StringProperty => nameof(StringProperty); | ||
public static int IntProperty => 42; | ||
public static IAmAnInterface InterfaceProperty => ConcreteImpl.Instance; | ||
public static AnAbstractClass AbstractProperty => ConcreteImpl.Instance; | ||
// ReSharper disable once UnusedMember.Local | ||
static string PrivateStringProperty => nameof(PrivateStringProperty); | ||
public string InstanceStringProperty => nameof(InstanceStringProperty); | ||
public static string StringField = nameof(StringField); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
using System; | ||
using Serilog.Core; | ||
using Serilog.Events; | ||
using TestDummies.Console.Themes; | ||
|
||
namespace TestDummies.Console | ||
{ | ||
public class DummyConsoleSink : ILogEventSink | ||
{ | ||
public DummyConsoleSink(ConsoleTheme theme = null) | ||
{ | ||
Theme = theme ?? ConsoleTheme.None; | ||
} | ||
|
||
[ThreadStatic] | ||
public static ConsoleTheme Theme; | ||
|
||
public void Emit(LogEvent logEvent) | ||
{ | ||
} | ||
} | ||
|
||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
namespace TestDummies.Console.Themes | ||
{ | ||
class ConcreteConsoleTheme : ConsoleTheme | ||
{ | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
namespace TestDummies.Console.Themes | ||
{ | ||
public abstract class ConsoleTheme | ||
{ | ||
public static ConsoleTheme None { get; } = new EmptyConsoleTheme(); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
namespace TestDummies.Console.Themes | ||
{ | ||
public static class ConsoleThemes | ||
{ | ||
public static ConsoleTheme Theme1 { get; } = new ConcreteConsoleTheme(); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
namespace TestDummies.Console.Themes | ||
{ | ||
class EmptyConsoleTheme : ConsoleTheme | ||
{ | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters