summaryrefslogtreecommitdiff
path: root/src/Notepad/Infrastructure/Logging/Log4NetLogging/Log4NetLogFactory.cs
blob: 0784a1363a23036360d5dc3add9f91ed4f73aa3f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
using System;
using System.IO;
using log4net;
using log4net.Config;

namespace Notepad.Infrastructure.Logging.Log4NetLogging {
    public class Log4NetLogFactory : ILogFactory {
        public Log4NetLogFactory() {
            XmlConfigurator.Configure(PathToConfigFile());
        }

        public ILogger CreateFor(Type typeToCreateLoggerFor) {
            return new Log4NetLogger(LogManager.GetLogger(typeToCreateLoggerFor));
        }

        private FileInfo PathToConfigFile() {
            return new FileInfo(Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "log4net.config.xml"));
        }
    }
}