示例#1
0
        /// <summary>
        /// Appends the action to the log stack.
        /// </summary>
        /// <param name="timeStampStarted">The time stamp started.</param>
        /// <param name="timeStampFinished">The time stamp finished.</param>
        /// <param name="operationName">Name of the operation.</param>
        /// <param name="response">The response.</param>
        public void AppendSolrAction(DateTime timeStampStarted, DateTime timeStampFinished, string operationName, ISolrResponseObject response)
        {
            string timeElapsed = $"{(timeStampFinished - timeStampStarted).TotalMilliseconds:0.0000}";

            StringBuilder entry = new StringBuilder();

            entry.Append($"{DateTime.Now}");
            entry.Append(response.Success ? "\tSuccess" : "\tFailed");
            entry.Append($"\t{operationName}");
            entry.Append($"\t{timeElapsed} ms\t");

            if (!string.IsNullOrEmpty(response.ImportResponse))
            {
                entry.Append($"\t{response.ImportResponse}");
            }


            _logCollection.Push(entry.ToString());

            if (_outputToFile)
            {
                WriteLog(operationName, entry.ToString());
            }

            OnLogAction?.Invoke(null);
        }
示例#2
0
        /// <summary>
        /// Appends the reload.
        /// </summary>
        public void AppendReload()
        {
            StringBuilder entry = new StringBuilder();

            entry.Append($"{DateTime.Now}");
            entry.Append("\tReloaded all Solr jobs");

            _logCollection.Push(entry.ToString());
            OnLogAction?.Invoke(null);
        }
示例#3
0
        /// <summary>
        /// Appends the cancellation to the log stack.
        /// </summary>
        /// <param name="operationName">Name of the operation.</param>
        /// <param name="action">The action.</param>
        public void AppendJobAction(string operationName, SolrLogAction action)
        {
            StringBuilder entry = new StringBuilder();

            entry.Append($"{DateTime.Now}");
            entry.Append($"\t{action}");
            entry.Append($"\t{operationName}");

            _logCollection.Push(entry.ToString());
            OnLogAction?.Invoke(null);
        }