1
0
mirror of https://github.com/ppy/osu.git synced 2024-12-14 14:32:55 +08:00

Add logging on import processes

This commit is contained in:
Dean Herbert 2018-05-29 16:14:09 +09:00
parent de8c4e6d56
commit 47d88a48a2
2 changed files with 10 additions and 2 deletions

View File

@ -107,6 +107,7 @@ namespace osu.Game.Beatmaps
{
Delete(existingOnlineId);
beatmaps.PurgeDeletable(s => s.ID == existingOnlineId.ID);
Logger.Log($"Found existing beatmap set with same OnlineBeatmapSetID ({model.OnlineBeatmapSetID}). It has been purged.", LoggingTarget.Database);
}
}
@ -303,7 +304,7 @@ namespace osu.Game.Beatmaps
{
// let's make sure there are actually .osu files to import.
string mapName = reader.Filenames.FirstOrDefault(f => f.EndsWith(".osu"));
if (string.IsNullOrEmpty(mapName)) throw new InvalidOperationException("No beatmap files found in the map folder.");
if (string.IsNullOrEmpty(mapName)) throw new InvalidOperationException("No beatmap files found in this beatmap archive.");
BeatmapMetadata metadata;
using (var stream = new StreamReader(reader.GetStream(mapName)))

View File

@ -190,7 +190,11 @@ namespace osu.Game.Database
var existing = CheckForExisting(item);
if (existing != null) return existing;
if (existing != null)
{
Logger.Log($"Found existing {typeof(TModel)} for {archive.Name} (ID {existing.ID}). Skipping import.", LoggingTarget.Database);
return existing;
}
item.Files = createFileInfos(archive, Files);
@ -205,9 +209,12 @@ namespace osu.Game.Database
throw;
}
}
Logger.Log($"Import of {archive.Name} successfully completed!", LoggingTarget.Database);
}
catch
{
Logger.Log($"Import of {archive.Name} failed and has been rolled back.", LoggingTarget.Database);
item = null;
}