Ejemplo n.º 1
0
        /// <summary>Gets the <see cref="LoggingLevel"/> flag with respect to the config file.
        /// </summary>
        /// <returns>The loaded <see cref="ExcelPoolLoggingLevel"/> or a standard value.</returns>
        internal static ExcelPoolLoggingLevel GetLoggingLevelFromConfigFile()
        {
            string loggingLevelAsString;

            if (ExcelAddIn.Configuration.GeneralSettings.TryGetValue(m_LoggingLevelConfigKey, out loggingLevelAsString) == false)
            {
                sm_LoggingLevel = ExcelPoolLoggingLevel.None;
            }
            else
            {
                if (EnumString <ExcelPoolLoggingLevel> .TryParse(loggingLevelAsString, out sm_LoggingLevel, EnumStringRepresentationUsage.StringAttribute) == false)
                {
                    throw new ConfigurationFileErrorException("Configuration file corrupt:" + loggingLevelAsString + " is no valid input for the global logfile logging level.");
                }
            }
            return(sm_LoggingLevel);
        }
Ejemplo n.º 2
0
 /// <summary>Sets the <see cref="LoggingLevel"/> flag and store it into the config file.
 /// </summary>
 /// <param name="loggingLevel">The logging level.</param>
 internal static void StoreLoggingLevel(ExcelPoolLoggingLevel loggingLevel)
 {
     sm_LoggingLevel = loggingLevel;
     ExcelAddIn.Configuration.GeneralSettings.SetValue(m_LoggingLevelConfigKey, loggingLevel.ToFormatString(EnumStringRepresentationUsage.StringAttribute));
 }