Example #1
0
        private string GetMessage()
        {
            // This is a little annoying to have to check this each time and to have to ensure that the LogTime is set before we try to set the LogMessage
            if (LogTime == DateTime.MinValue)
            {
                return(string.Empty);
            }

            if (RawLogLine.Length <= MessageStart)
            {
                return(string.Empty);
            }

            return(RawLogLine.Substring(MessageStart).Trim());
        }
Example #2
0
        private DateTime GetTime()
        {
            // [Fri Apr 26 10:17:02 2019]
            // [Sat Apr 20 19:23:28 2019]

            //int length = RawLogLine.IndexOf(']') - 1;

            try
            {
                var datePortion = RawLogLine.Substring(1, DateLength);
                return(DateTime.ParseExact(datePortion, "ddd MMM dd HH:mm:ss yyyy", CultureInfo.InstalledUICulture));
            }
            catch
            {
                return(DateTime.MinValue);
            }
        }