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.
Merge pull request serilog#1064 from tsimbalar/settings-static-member
Add support for reference to public static properties in settings
- Loading branch information
Showing
13 changed files
with
304 additions
and
5 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
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,41 @@ | ||
| ||
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 IAmAnInterface InterfaceProperty => ConcreteImpl.Instance; | ||
public static AnAbstractClass AbstractProperty => ConcreteImpl.Instance; | ||
|
||
public static IAmAnInterface InterfaceField = ConcreteImpl.Instance; | ||
public static AnAbstractClass AbstractField = ConcreteImpl.Instance; | ||
|
||
// ReSharper disable once UnusedMember.Local | ||
static IAmAnInterface PrivateInterfaceProperty => ConcreteImpl.Instance; | ||
#pragma warning disable 169 | ||
static IAmAnInterface PrivateInterfaceField = ConcreteImpl.Instance; | ||
#pragma warning restore 169 | ||
public IAmAnInterface InstanceInterfaceProperty => ConcreteImpl.Instance; | ||
public IAmAnInterface InstanceInterfaceField = ConcreteImpl.Instance; | ||
|
||
} | ||
} |
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 | ||
{ | ||
} | ||
} |
Oops, something went wrong.