示例#1
0
        public static string GetAppSettingsValue(string keyName, LoggingLevels levelToLog)
        {
            s_configurationFileReader = s_configurationFileReader ?? ConfigurationFileReaderProvider.Service;
            string value = s_configurationFileReader.GetValue(keyName);

            if (string.IsNullOrEmpty(value))
            {
                switch (levelToLog)
                {
                case LoggingLevels.Info:
                    Log.Info("Parameter {0} not found in appsettings", keyName);
                    break;

                case LoggingLevels.Trace:
                    Log.Trace("Parameter {0} not found in appsettings", keyName);
                    break;

                case LoggingLevels.Warning:
                    Log.Warning("Parameter {0} not found in appsettings", keyName);
                    break;

                case LoggingLevels.Error:
                    Log.Error("Parameter {0} not found in appsettings", keyName);
                    break;

                case LoggingLevels.None:
                    break;
                }
            }

            return(value);
        }
示例#2
0
        public static string GetAppSettingsValue(string keyName, bool logNotFound)
        {
            s_configurationFileReader = s_configurationFileReader ?? ConfigurationFileReaderProvider.Service;
            string value = s_configurationFileReader.GetValue(keyName);
            if (logNotFound)
            {
                if (string.IsNullOrEmpty(value))
                {
                    Log.Error("Parameter {0} not found in appsettings", keyName);
                }
            }

            return value;
        }
示例#3
0
        public static string GetAppSettingsValue(string keyName, bool logNotFound)
        {
            s_configurationFileReader = s_configurationFileReader ?? ConfigurationFileReaderProvider.Service;
            string value = s_configurationFileReader.GetValue(keyName);

            if (logNotFound)
            {
                if (string.IsNullOrEmpty(value))
                {
                    Log.Error("Parameter {0} not found in appsettings", keyName);
                }
            }

            return(value);
        }
示例#4
0
        public static string GetAppSettingsValue(string keyName, LoggingLevels levelToLog)
        {
            s_configurationFileReader = s_configurationFileReader ?? ConfigurationFileReaderProvider.Service;
            string value = s_configurationFileReader.GetValue(keyName);

            if (string.IsNullOrEmpty(value))
            {
                switch (levelToLog)
                {
                    case LoggingLevels.Info:
                        Log.Info("Parameter {0} not found in appsettings", keyName);
                        break;
                    case LoggingLevels.Trace:
                        Log.Trace("Parameter {0} not found in appsettings", keyName);
                        break;
                    case LoggingLevels.Warning:
                        Log.Warning("Parameter {0} not found in appsettings", keyName);
                        break;
                    case LoggingLevels.Error:
                        Log.Error("Parameter {0} not found in appsettings", keyName);
                        break;
                    case LoggingLevels.None:
                        break;
                }
            }

            return value;
        }