public void Write(LoggingLevel level, string message, Exception exception, Type source) { var connectionKey = ConnectionKey; var insertCommand = InsertCommand; var parameters = new DynamicParameters(new Dictionary <string, object>() { { "@date", DateTime.Now }, { "@utcdate", DateTime.UtcNow }, { "@level", EnumMapper.GetName(level) }, { "@message", message }, { "@exception", exception != null ? exception.ToString() : null }, { "@source", source != null ? source.FullName : null }, { "@thread", Thread.CurrentThread.ManagedThreadId } }); lock (sync) queue.Enqueue(parameters); signal.Set(); }