コード例 #1
0
        /// <summary>
        /// Generates a formatted message for HergBot Markup Language logging
        /// </summary>
        /// <param name="timestamp">The logs timestamp</param>
        /// <param name="threadName">The name of the thread the message is logged from</param>
        /// <param name="methodName">The name of the method logging the message</param>
        /// <param name="type">The label for the type of log message</param>
        /// <param name="message">The log message</param>
        /// <returns>A formatted HBML element string for logging</returns>
        public string GenerateLogMessage(string timestamp, string threadName, string methodName, string type, string message)
        {
            // Build the element for the log entry
            HbmlElement logElement = new HbmlElement(LOG_ELEMENT_LABEL);

            logElement.AddElement(LOG_DATE_LABEL, timestamp);
            logElement.AddElement(LOG_TYPE_LABEL, type);
            logElement.AddElement(LOG_THREAD_NAME_LABEL, threadName);
            logElement.AddElement(LOG_METHOD_NAME_LABEL, methodName);
            logElement.AddElement(LOG_MESSAGE_LABEL, message);
            return(logElement.ToString());
        }
コード例 #2
0
        public void ToString_Base()
        {
            string expected = $"<{TEST_LABEL}></{TEST_LABEL}>";

            Assert.AreEqual(expected, _testElement.ToString());
        }