Beispiel #1
0
        public static void WriteLog(LogClassification logClassification, string message, string data)
        {
            using (var db = new UpdateProgramDbContext())
            {
                // Debug log.
                db.Database.Log = s => System.Diagnostics.Debug.WriteLine(s);

                db.Logs.Add(new Log()
                {
                    TimestampUtc     = DateTime.UtcNow,
                    Source           = Assembly.GetEntryAssembly().GetName().Name,
                    ClassificationId = (short)logClassification,
                    Message          = message,
                    Data             = data ?? string.Empty,
                });

                db.SaveChanges();
            }
        }
Beispiel #2
0
 public static void WriteLog(LogClassification logClassification, string message)
 {
     WriteLog(logClassification, message, null);
 }