Esempio n. 1
0
        public void Log(string command, DateTime executionStartTimestamp, DateTime executionEndTimestamp)
        {
            lock (_logQueue)
            {
                if (_logQueue.Count >= LogLimit)
                    _logQueue.Dequeue();

                var commandLogEntry = new CommandLogEntry(command, executionStartTimestamp, executionEndTimestamp);
                _logQueue.Enqueue(commandLogEntry);
            }
            CommandsChanged();
        }
        public void Log(string command, DateTime executionStartTimestamp, DateTime executionEndTimestamp)
        {
            lock (_logQueue)
            {
                if (_logQueue.Count >= LogLimit)
                {
                    _logQueue.Dequeue();
                }

                var commandLogEntry = new CommandLogEntry(command, executionStartTimestamp, executionEndTimestamp);
                _logQueue.Enqueue(commandLogEntry);
            }
            CommandsChanged();
        }
Esempio n. 3
0
        public void Log(string command, DateTime executionStartTimestamp, DateTime executionEndTimestamp)
        {
            lock (_logQueue)
            {
                if (_logQueue.Count >= LogLimit)
                    _logQueue.Dequeue();

                var commandLogEntry = new CommandLogEntry(command, executionStartTimestamp, executionEndTimestamp);
                _logQueue.Enqueue(commandLogEntry);
            }

            var handler = CommandsChanged;
            if (handler != null)
                handler(this, EventArgs.Empty);
        }
Esempio n. 4
0
        public static ProcessOperation LogProcessStart(string fileName, string arguments = "")
        {
            const int MaxEntryCount = 500;

            var entry = new CommandLogEntry(fileName, arguments, DateTime.Now, ThreadHelper.JoinableTaskContext.IsOnMainThread);

            _queue.Enqueue(entry);

            // Trim extra items
            while (_queue.Count >= MaxEntryCount)
            {
                _queue.TryDequeue(out _);
            }

            CommandsChanged?.Invoke();

            return(new ProcessOperation(entry, Stopwatch.StartNew(), () => CommandsChanged?.Invoke()));
        }
Esempio n. 5
0
        /// <summary>
        /// Add the command to the log fifo queue
        /// </summary>
        /// <param name="command">The (Git) command to log</param>
        /// <param name="timestamp">The time for the log</param>
        /// <returns>The log entry reference, null if not added</returns>
        public CommandLogEntry LogEntry(string command, DateTime timestamp)
        {
            CommandLogEntry commandLogEntry = null;

            lock (_logQueue)
            {
                if (_logQueue.Count >= LogLimit)
                {
                    _logQueue.Dequeue();
                }

                commandLogEntry = new CommandLogEntry(command, timestamp);
                _logQueue.Enqueue(commandLogEntry);
            }

            CommandsChanged?.Invoke(this, EventArgs.Empty);
            return(commandLogEntry);
        }
Esempio n. 6
0
        public void Log(string command, DateTime executionStartTimestamp, DateTime executionEndTimestamp)
        {
            lock (_logQueue)
            {
                if (_logQueue.Count >= LogLimit)
                {
                    _logQueue.Dequeue();
                }

                var commandLogEntry = new CommandLogEntry(command, executionStartTimestamp, executionEndTimestamp);
                _logQueue.Enqueue(commandLogEntry);
            }

            var handler = CommandsChanged;

            if (handler != null)
            {
                handler(this, EventArgs.Empty);
            }
        }
Esempio n. 7
0
 internal ProcessOperation(CommandLogEntry entry, Stopwatch stopwatch, Action raiseCommandsChanged)
 {
     _entry                = entry;
     _stopwatch            = stopwatch;
     _raiseCommandsChanged = raiseCommandsChanged;
 }