OpenLog() public static method

public static OpenLog ( string operationName ) : void
operationName string
return void
        public static void DoWork(string inputFileSpec)
        {
            Logger.OpenLog("CommentUDCXFileNodes");
            Logger.LogInfoMessage(String.Format("Scan starting {0}", DateTime.Now.ToString()), true);
            Logger.LogInfoMessage(inputFileSpec, true);

            List <UdcxReportOutput> _WriteUDCList = null;

            Logger.LogInfoMessage(String.Format("AppSettings:"), true);
            Logger.LogInfoMessage(String.Format("- AppSettings[UseAppModel] = {0}", Program.UseAppModel), true);
            if (Program.UseAppModel == true)
            {
                Logger.LogInfoMessage(String.Format("- AppId = {0}", ConfigurationManager.AppSettings["ClientId"].ToString()), true);
            }
            else
            {
                string adminUsername = String.Format("{0}{1}", (String.IsNullOrEmpty(Program.AdminDomain) ? "" : String.Format("{0}\\", Program.AdminDomain)), Program.AdminUsername);
                Logger.LogInfoMessage(String.Format("- Admin Username = {0}", adminUsername), true);
            }

            IEnumerable <UdcxReportInput> udcxCSVRows = ImportCSV.ReadMatchingColumns <UdcxReportInput>(inputFileSpec, Constants.CsvDelimeter);

            if (udcxCSVRows != null)
            {
                try
                {
                    var authRows = udcxCSVRows.Where(x => x.Authentication != null && x.Authentication != Constants.ErrorStatus && x.Authentication.Length > 0);
                    if (authRows != null && authRows.Count() > 0)
                    {
                        _WriteUDCList = new List <UdcxReportOutput>();
                        Logger.LogInfoMessage(String.Format("Preparing to process a total of {0} Udcx Files ...", authRows.Count()), true);

                        foreach (UdcxReportInput udcxFileInput in authRows)
                        {
                            CommentUDCXFileNode(udcxFileInput, _WriteUDCList);
                        }

                        GenerateStatusReport(_WriteUDCList);
                    }
                    else
                    {
                        Logger.LogInfoMessage("No UDCX File records with authentication nodes found in '" + inputFileSpec + "' File ", true);
                    }
                }
                catch (Exception ex)
                {
                    Logger.LogErrorMessage(String.Format("CommentUDCXFileNode() failed: Error={0}", ex.Message), true);
                }

                Logger.LogInfoMessage(String.Format("Scan completed {0}", DateTime.Now.ToString()), true);
            }
            else
            {
                Logger.LogInfoMessage("No UDCX File records found in '" + inputFileSpec + "' File ", true);
            }

            Logger.CloseLog();
        }
Esempio n. 2
0
        public static void DoWork(string inputFileSpec)
        {
            Logger.OpenLog("CommentUDCXFileNodes");
            Logger.LogInfoMessage(String.Format("Scan starting {0}", DateTime.Now.ToString()), true);
            Logger.LogInfoMessage(inputFileSpec, true);

            List <UdcxReportOutput> _WriteUDCList = null;

            IEnumerable <UdcxReportInput> udcxCSVRows = ImportCSV.ReadMatchingColumns <UdcxReportInput>(inputFileSpec, Constants.CsvDelimeter);

            if (udcxCSVRows != null)
            {
                try
                {
                    var authRows = udcxCSVRows.Where(x => x.Authentication != null && x.Authentication != Constants.ErrorStatus && x.Authentication.Length > 0);
                    if (authRows != null && authRows.Count() > 0)
                    {
                        _WriteUDCList = new List <UdcxReportOutput>();
                        Logger.LogInfoMessage(String.Format("Preparing to comment a total of {0} Udcx Files Nodes ...", authRows.Count()), true);

                        foreach (UdcxReportInput udcxFileInput in authRows)
                        {
                            CommentUDCXFileNode(udcxFileInput, _WriteUDCList);
                        }

                        GenerateStatusReport(_WriteUDCList);
                    }
                    else
                    {
                        Logger.LogInfoMessage("No valid authentication records found in '" + inputFileSpec + "' File ", true);
                    }
                }
                catch (Exception ex)
                {
                    Logger.LogErrorMessage(String.Format("CommentUDCXFileNode() failed: Error={0}", ex.Message), true);
                }

                Logger.LogInfoMessage(String.Format("Scan completed {0}", DateTime.Now.ToString()), true);
            }
            else
            {
                Logger.LogInfoMessage("No records found in '" + inputFileSpec + "' File ", true);
            }

            Logger.CloseLog();
        }