我有一个包含多个.EXE,WCF服务,Windows服务等的解决方案...我想使用SeriLog登录所有这些但我不希望这些项目直接添加SeriLog . 我希望它们依赖于具有各种功能的Frameword dll,例如电子邮件,配置等......为此,我想在此Framework dll中创建一个包装类 . 然后我的所有项目都可以引用这个包装类(它们已经引用的dll的一部分) . 所以,我想要的东西:

public class TheLogger : Serilog.ILogger
{
    private static readonly TheLogger instance = new TheLogger();

    /// <summary>
    /// Creates the singleton instance of TheLogger class.
    /// </summary>
    static TheLogger()
    {
        // Configure SeriLog
        var log = new LoggerConfiguration().WriteTo.Console().CreateLogger();
        Log.logger = log;

        // Need to point the instance to SeriLog's implementation ????
        instance = (TheLogger)log;

    }

    private TheLogger()
    {

    }

    /// <summary>
    /// Returns the singleton instance of TheLogger class.
    /// </summary>
    public static TheLogger Instance
    {
        get
        {
            return instance;
        }
    }
}

然后,我希望其他项目使用类似的语法

TheLogger.Instance.Information("I am here");

但显然,TheLogger没有SeriLog的Log.logger静态 Logger 提供的实现 . 如果没有引用SeriLog,我就无法引用Log.logger . 总而言之,问题是如何利用SeriLog的Log.logger将其包装在我自己的类中?