コード例 #1
0
        public void ConfigureNLog(HostSettings settings)
        {
            var logConfig = new XmlLoggingConfiguration("NLog.config");

            if (!logConfig.Variables.TryGetValue("logDirectory", out SimpleLayout logDirectory))
            {
                logConfig.Variables.Add("logDirectory", new SimpleLayout(settings.LogPath));
            }
            else
            {
                logConfig.Variables["logDirectory"] = settings.LogPath;
            }

            LogManager.Configuration = logConfig;
        }