示例#1
0
        public static void Main(string[] args)
        {
            //			// TODO: JobLogger instantiation must be done by IOC.
            //			IKernel kernel = new StandardKernel(new IocModule());
            //			JobLogger sample = kernel.Get<JobLogger> ();
            ILogger[] loggers = new ILogger[] {
                new ConsoleLogger(),
                new SqlLogger(),
                new FileLogger()
            };
            JobLogger sample = new JobLogger(loggers);

            sample.LogMessage ("This is a sample warning message.", LogMessageLevel.Warning);
            sample.LogMessage ("Error! Just kidding! It's a sample too.", LogMessageLevel.Error);
        }
示例#2
0
文件: Test.cs 项目: RoydeM/Belatrix
        public void Setup()
        {
            consoleLogger = new Mock<ILogger> ();
            consoleLogger.Setup(c => c.GetOutputType()).Returns(LogOutputType.Console);

            sqlLogger = new Mock<ILogger> ();
            sqlLogger.Setup(s => s.GetOutputType()).Returns(LogOutputType.Database);

            fileLogger = new Mock<ILogger> ();
            fileLogger.Setup(f => f.GetOutputType()).Returns(LogOutputType.File);

            ILogger[] loggers = new ILogger[] {
                consoleLogger.Object,
                sqlLogger.Object,
                fileLogger.Object
            };
            logger = new JobLogger(loggers);
        }