示例#1
0
 private void TestLogMessage(LogMessage message, KissLog.RestClient.Requests.CreateRequestLog.LogMessage result)
 {
     Assert.AreEqual(message.CategoryName, result.CategoryName);
     Assert.AreEqual(message.LogLevel.ToString(), result.LogLevel);
     Assert.AreEqual(message.Message, result.Message);
     Assert.AreEqual(message.MemberType, result.MemberType);
     Assert.AreEqual(message.MemberName, result.MemberName);
     Assert.AreEqual(message.LineNumber, result.LineNumber);
     Assert.IsTrue(result.MillisecondsSinceStartRequest >= 0);
 }
示例#2
0
        internal static KissLog.RestClient.Requests.CreateRequestLog.LogMessage Create(LogMessage message, DateTime startRequestDateTime)
        {
            if (message == null)
            {
                throw new ArgumentNullException(nameof(message));
            }

            var result = new KissLog.RestClient.Requests.CreateRequestLog.LogMessage
            {
                CategoryName = message.CategoryName,
                LogLevel     = message.LogLevel.ToString(),
                Message      = message.Message,
                MillisecondsSinceStartRequest = Math.Max(0, (message.DateTime - startRequestDateTime).TotalMilliseconds),
                MemberType = message.MemberType,
                MemberName = message.MemberName,
                LineNumber = message.LineNumber
            };

            return(result);
        }