/// <summary> /// Logging directly to the database, for special cases omitting the use of a dedicated logger. /// </summary> /// <remarks>Utilizes a blocking connection to the database.</remarks> internal static void LogInternalMessage(string logger, DbModels.Log.NLogLevel level, string message) { using (var context = _contextProvider.GetInstance()) { context.LogRecords.Add(new DbModels.Log.CodeFirst.LogRecord() { Level = level, Logger = logger, Message = new DbModels.Log.CodeFirst.Message() { Text = message }, TimeStamp = DateTime.UtcNow, }); context.SaveChanges(); } }
public static NLog.LogLevel ToLogLevel(this DbModels.Log.NLogLevel value) { // LogLevel <0, 6> return(NLog.LogLevel.FromOrdinal((int)value > 6 ? 0 : (int)value)); //?? }