public void WriteXml(XmlWriter writer) { writer.WriteStartElement("ExperimentSettings"); writer.WriteAttributeString("Version", CurrentVersion.ToString()); writer.WriteElementString("ExperimentID", ExperimentID); writer.WriteElementString("LastOpened", LastOpened.ToUniversalTime().ToString("yyyy-MM-ddTHH:mm:ss.fffffff")); // ExperimentLogLevels { List <GlobalLogLevelSetting> settings = new List <GlobalLogLevelSetting>(); foreach (GlobalLogLevelSetting setting in m_globalLogLevelSettings) { GlobalLogLevelSetting defaultVersion = s_defaultSettings[setting.Level]; if (setting.IsEnabled != defaultVersion.IsEnabled) { settings.Add(setting); } } if (settings.Count > 0) { XmlSerializer serializer = TraceLab.Core.Serialization.XmlSerializerFactory.GetSerializer(typeof(List <GlobalLogLevelSetting>), null); serializer.Serialize(writer, settings); } } writer.WriteEndElement(); // ExperimentSettings }
public GlobalLogLevelSetting GetGlobalLogLevel(NLog.LogLevel level) { GlobalLogLevelSetting val = null; LogLevel lev = level; m_globalLogLevelSettingLookup.TryGetValue(lev, out val); return(val); }
private void SetupDefaultGlobalLogLevels() { foreach (GlobalLogLevelSetting logLevel in s_defaultSettings) { var setting = new GlobalLogLevelSetting(logLevel.Level, logLevel.IsEnabled, logLevel.IsLocked); m_globalLogLevelSettingLookup.Add(setting.Level, setting); m_globalLogLevelSettings.Add(setting); } }
/// <summary> /// Sets the global log level setting. /// </summary> /// <param name="logLevelSetting">The log level setting.</param> public void SetGlobalLogLevelSetting(GlobalLogLevelSetting logLevelSetting) { if (logLevelSetting == null) { throw new ArgumentNullException("logLevelSetting"); } //update global log level settings SetGlobalLogLevel(logLevelSetting.Level, logLevelSetting.IsEnabled); }