Beispiel #1
0
        /// <summary>
        /// Returns all logged activities for <paramref name="rootObject"/>
        /// </summary>
        /// <param name="rootObject"></param>
        /// <returns></returns>
        protected IEnumerable <ArchivalDataLoadInfo> GetLogs(ILoggedActivityRootObject rootObject)
        {
            var db   = rootObject.GetDistinctLoggingDatabase();
            var task = rootObject.GetDistinctLoggingTask();

            var lm = new LogManager(db);

            return(rootObject.FilterRuns(lm.GetArchivalDataLoadInfos(task)));
        }
Beispiel #2
0
        /// <summary>
        /// Checks the RDMP logs for the latest log entry of a given object.  Throws (returns exit code non zero) if
        /// the top log entry is failing or if there are no log entries within the expected time span.
        /// </summary>
        /// <param name="activator"></param>
        /// <param name="obj"></param>
        /// <param name="withinTime"></param>
        public ExecuteCommandConfirmLogs(IBasicActivateItems activator,

                                         [DemandsInitialization("The object you want to confirm passing log entries for")]
                                         ILoggedActivityRootObject obj,

                                         [DemandsInitialization("Optional time period in which to expect successful logs e.g. 24:00:00 (24 hours)")]
                                         string withinTime = null) : base(activator)
        {
            LogRootObject = obj;
            if (withinTime != null)
            {
                var decider = new TimeSpanTypeDecider(CultureInfo.CurrentCulture);
                WithinTime = (TimeSpan)decider.Parse(withinTime);
            }
        }
Beispiel #3
0
        public ExecuteCommandViewLogs(IBasicActivateItems activator, CommandLineObjectPicker picker) : base(activator)
        {
            if (picker.Length == 0)
            {
                SetImpossible("Insufficient arguments supplied");
                return;
            }

            if (picker[0].HasValueOfType(typeof(DatabaseEntity)))
            {
                var obj = picker[0].GetValueForParameterOfType(typeof(DatabaseEntity));

                if (obj is ILoggedActivityRootObject root)
                {
                    RootObject = root;
                }
                if (obj is ExternalDatabaseServer eds)
                {
                    _loggingServers = new ExternalDatabaseServer[] { eds }
                }
                ;
            }

            LoggingTables table = LoggingTables.None;

            if (picker.Length >= 1)
            {
                if (Enum.TryParse(picker[0].RawValue, out table))
                {
                    _filter = new LogViewerFilter(table);
                }
            }

            if (picker.Length >= 2)
            {
                if (int.TryParse(picker[0].RawValue, out int id))
                {
                    _filter = new LogViewerFilter(table, id);
                }
            }
        }
Beispiel #4
0
        public override void ShowLogs(ILoggedActivityRootObject rootObject)
        {
            foreach (var load in base.GetLogs(rootObject).OrderByDescending(l => l.StartTime))
            {
                Console.WriteLine(load.Description);
                Console.WriteLine(load.StartTime);

                Console.WriteLine("Errors:" + load.Errors.Count);

                foreach (var error in load.Errors)
                {
                    error.GetSummary(out string title, out string body, out _, out CheckResult _);

                    Console.WriteLine($"\t{title}");
                    Console.WriteLine($"\t{body}");
                }

                Console.WriteLine("Tables Loaded:");

                foreach (var t in load.TableLoadInfos)
                {
                    Console.WriteLine($"\t{t}: I={t.Inserts:N0} U={t.Updates:N0} D={t.Deletes:N0}");

                    foreach (var source in t.DataSources)
                    {
                        Console.WriteLine($"\t\tSource:{source.Source}");
                    }
                }

                Console.WriteLine("Progress:");

                foreach (var p in load.Progress)
                {
                    Console.WriteLine($"\t{p.Date} {p.Description}");
                }
            }
        }
Beispiel #5
0
 public ExecuteCommandViewLogs(IActivateItems activator, ILoggedActivityRootObject rootObject) : base(activator)
 {
     RootObject = rootObject;
 }
Beispiel #6
0
 public override void ShowLogs(ILoggedActivityRootObject rootObject)
 {
     Activate <LoadEventsTreeView>(new LoadEventsTreeViewObjectCollection(rootObject));
 }
Beispiel #7
0
        public ConsoleGuiViewLogs(IBasicActivateItems activator, ILoggedActivityRootObject rootObject)
        {
            this._activator  = activator;
            Modal            = true;
            this._rootObject = rootObject;

            ColorScheme = ConsoleMainWindow.ColorScheme;

            var lbl = new Label($"Logs for '{rootObject}'");

            Add(lbl);

            var lblToFetch = new Label("Max:")
            {
                X = Pos.Right(lbl) + 1,
            };

            Add(lblToFetch);

            _tbToFetch = new TextField()
            {
                X     = Pos.Right(lblToFetch),
                Text  = "1000",
                Width = 10
            };

            Add(_tbToFetch);

            var btnFetch = new Button()
            {
                X    = Pos.Right(_tbToFetch),
                Text = "Go"
            };

            btnFetch.Clicked += FetchLogs;

            Add(btnFetch);

            var lblFilter = new Label("Filter:")
            {
                Y = Pos.Bottom(lbl)
            };

            Add(lblFilter);

            var btnAll = new Button("All")
            {
                Y = Pos.Bottom(lbl),
                X = Pos.Right(lblFilter)
            };

            btnAll.Clicked += BtnAll_Clicked;
            Add(btnAll);

            var btnFailing = new Button("Failing")
            {
                Y = Pos.Bottom(lbl),
                X = Pos.Right(btnAll)
            };

            btnFailing.Clicked += BtnFailing_Clicked;
            Add(btnFailing);

            var btnPassing = new Button("Passing")
            {
                Y = Pos.Bottom(lbl),
                X = Pos.Right(btnFailing)
            };

            btnPassing.Clicked += BtnPassing_Clicked;
            Add(btnPassing);


            var lblcontains = new Label("Contains:")
            {
                Y = Pos.Bottom(lbl),
                X = Pos.Right(btnPassing) + 1
            };

            Add(lblcontains);

            _tbcontains = new TextField()
            {
                Y     = Pos.Bottom(lbl),
                X     = Pos.Right(lblcontains),
                Width = 10
            };
            _tbcontains.TextChanged += Tbcontains_TextChanged;
            Add(_tbcontains);

            _treeView = new TreeView <object>()
            {
                X      = 0,
                Y      = Pos.Bottom(lblFilter),
                Width  = Dim.Fill(),
                Height = Dim.Fill(1),
            };
            _treeView.TreeBuilder      = this;
            _treeView.ObjectActivated += _treeView_ObjectActivated;;
            Add(_treeView);

            var close = new Button("Quit")
            {
                Y = Pos.Bottom(_treeView),
                X = 0
            };

            close.Clicked += Quit;

            Add(close);

            FetchLogs();
        }
Beispiel #8
0
 public override void ShowLogs(ILoggedActivityRootObject rootObject)
 {
     throw new NotImplementedException();
 }
Beispiel #9
0
 /// <summary>
 /// Presents user with log info about <paramref name="rootObject"/>.  Inheritors may wish to use <see cref="GetLogs(ILoggedActivityRootObject)"/>.
 /// </summary>
 /// <param name="rootObject"></param>
 public abstract void ShowLogs(ILoggedActivityRootObject rootObject);
Beispiel #10
0
        public override void ShowLogs(ILoggedActivityRootObject rootObject)
        {
            var view = new ConsoleGuiViewLogs(this, rootObject);

            Application.Run(view);
        }