mirror of
https://github.com/ppy/osu.git
synced 2024-11-13 17:27:48 +08:00
Merge pull request #25300 from peppy/better-submission-logging
Improve log output surrounding score submission
This commit is contained in:
commit
19d10e5e45
@ -7,6 +7,7 @@ using System;
|
||||
using System.Globalization;
|
||||
using JetBrains.Annotations;
|
||||
using Newtonsoft.Json;
|
||||
using osu.Framework.Extensions.TypeExtensions;
|
||||
using osu.Framework.IO.Network;
|
||||
using osu.Framework.Logging;
|
||||
using osu.Game.Extensions;
|
||||
@ -46,7 +47,7 @@ namespace osu.Game.Online.API
|
||||
if (WebRequest != null)
|
||||
{
|
||||
Response = ((OsuJsonWebRequest<T>)WebRequest).ResponseObject;
|
||||
Logger.Log($"{GetType()} finished with response size of {WebRequest.ResponseStream.Length:#,0} bytes", LoggingTarget.Network);
|
||||
Logger.Log($"{GetType().ReadableName()} finished with response size of {WebRequest.ResponseStream.Length:#,0} bytes", LoggingTarget.Network);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -188,7 +188,10 @@ namespace osu.Game.Screens.Play
|
||||
{
|
||||
// token may be null if the request failed but gameplay was still allowed (see HandleTokenRetrievalFailure).
|
||||
if (token == null)
|
||||
{
|
||||
Logger.Log("No token, skipping score submission");
|
||||
return Task.CompletedTask;
|
||||
}
|
||||
|
||||
if (scoreSubmissionSource != null)
|
||||
return scoreSubmissionSource.Task;
|
||||
@ -197,6 +200,8 @@ namespace osu.Game.Screens.Play
|
||||
if (!score.ScoreInfo.Statistics.Any(s => s.Key.IsHit() && s.Value > 0))
|
||||
return Task.CompletedTask;
|
||||
|
||||
Logger.Log($"Beginning score submission (token:{token.Value})...");
|
||||
|
||||
scoreSubmissionSource = new TaskCompletionSource<bool>();
|
||||
var request = CreateSubmissionRequest(score, token.Value);
|
||||
|
||||
@ -206,11 +211,12 @@ namespace osu.Game.Screens.Play
|
||||
score.ScoreInfo.Position = s.Position;
|
||||
|
||||
scoreSubmissionSource.SetResult(true);
|
||||
Logger.Log($"Score submission completed! (token:{token.Value} id:{s.ID})");
|
||||
};
|
||||
|
||||
request.Failure += e =>
|
||||
{
|
||||
Logger.Error(e, $"Failed to submit score ({e.Message})");
|
||||
Logger.Error(e, $"Failed to submit score (token:{token.Value}): {e.Message}");
|
||||
scoreSubmissionSource.SetResult(false);
|
||||
};
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user