private async Task Insert(string level, string component, string process, string context, string type, string stack, string msg, DateTime?dateTime) { var dt = dateTime ?? DateTime.UtcNow; var newEntity = LogEntity.Create(level, component, process, context, type, stack, msg, dt); if (level == "error" || level == "fatalerror") { await _errorTableStorage.InsertAndGenerateRowKeyAsTimeAsync(newEntity, dt); } if (level == "warning") { await _warningTableStorage.InsertAndGenerateRowKeyAsTimeAsync(newEntity, dt); } if (level == "info") { await _infoTableStorage.InsertAndGenerateRowKeyAsTimeAsync(newEntity, dt); } }
private async Task Insert(string level, string component, string process, string context, string type, string stack, string msg, DateTime?dateTime) { var dt = dateTime ?? DateTime.UtcNow; var newEntity = LogEntity.Create(level, component, process, context, type, stack, msg, dt); switch (level) { case "info": await _tableStorageInfo.InsertAndGenerateRowKeyAsTimeAsync(newEntity, dt); break; case "warning": await _tableStorageWarning.InsertAndGenerateRowKeyAsTimeAsync(newEntity, dt); break; default: await _tableStorageError.InsertAndGenerateRowKeyAsTimeAsync(newEntity, dt); break; } }