Esempio n. 1
0
 private static object ToEntry(LoggerEntry entry)
 {
     return(new
     {
         Timestamp = entry.Timestamp.ToString("yyyy-MM-dd HH:mm:ss"),
         Message = entry.Message
     });
 }
Esempio n. 2
0
        public static void Info(string message)
        {
            lock (entries)
            {
                LoggerEntry entry = new LoggerEntry
                {
                    Timestamp = DateTime.Now,
                    Message   = message
                };

                entries.Add(entry);
                callback?.OnNew(ToEntry(entry));

                if (entries.Count > 100)
                {
                    callback?.OnDisposed(ToEntry(entries[0]));
                    entries.RemoveAt(0);
                }
            }
        }