Пример #1
0
        private static void SaveToContigency(string message, EnumMessageType enumMessageType = EnumMessageType.Information)
        {
            string whereToSave = ConfigHelper.GetKeyAppSettings("Log_TrySave_Set_Sequence_EnumLogType_Contingency");

            string[] vetEnumLogType = whereToSave.Split(',');

            int contingencyNumberUsed          = 0;
            int contingencyNumberUsedWithError = 0;

            foreach (var enumLogType in vetEnumLogType)
            {
                ILog log = FactoryLog.GetLogType(enumLogType);

                contingencyNumberUsed++;

                try
                {
                    log.Save(message, enumMessageType);

                    break;
                }
                catch
                {
                    contingencyNumberUsedWithError++;
                }
            }

            if (contingencyNumberUsed == contingencyNumberUsedWithError)
            {
                throw new Exception("LOG_CONTIGENCY -> Não foi possível salvar o log.");
            }
        }
Пример #2
0
        private static void SaveToAll(string message, EnumMessageType enumMessageType)
        {
            string whereToSave = ConfigHelper.GetKeyAppSettings("Log_SaveAll_Set_Sequence_EnumLogType");

            whereToSave.Trim().Split(',').ToList().ForEach(enumLogType =>
            {
                ILog log = FactoryLog.GetLogType(enumLogType);

                log.Save(message, enumMessageType);
            });
        }