Skip to content

Commit d45b82a

Browse files
committed
fix logging
1 parent 08509c2 commit d45b82a

File tree

8 files changed

+50
-64
lines changed

8 files changed

+50
-64
lines changed

Components/BlendAnimatorBasedScreen.cs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22
// http://www.apache.org/licenses/LICENSE-2.0
33
using UnityEngine;
44
using System.Collections;
5-
using Assets.Sources.Util.Log;
65

76
namespace Assets.Sources.Scripts.Basic
87
{

Core/NativePlatform/Platforms/NativeEditor.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,9 @@
44

55
using System;
66
using System.Collections.Generic;
7+
using Assets.Plugins.DeepLabs.Core.Utils.Log;
78
using Assets.Sources.Logic.Data;
89
using Assets.Sources.Util.Data;
9-
using Assets.Sources.Util.Log;
1010
using Assets.Sources.Util.UI;
1111
using UnityEngine;
1212

@@ -25,7 +25,7 @@ public void BuyInAppPurchase(string productId, string userId, string orderId, st
2525
{
2626
var purchase = new PurchaseInfo(userId, orderId, "0", string.Format("productId : {0}", productId), "this is a test from Unity player");
2727
purchases.Add(purchase);
28-
LogProxy.Log("Bought " + purchase.ToString());
28+
Lc.D("Bought " + purchase);
2929

3030
GameObject.Find(callBackObj).SendMessage(callbackMethod, null);
3131
}

Core/Utils/Log/Lc.cs

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
using JetBrains.Annotations;
2+
using UnityEditor;
3+
using UnityEngine;
4+
5+
namespace Assets.Plugins.DeepLabs.Core.Utils.Log
6+
{
7+
public class Lc
8+
{
9+
public static void D([NotNull] object message)
10+
{
11+
Debug.Log(message.ToString());
12+
}
13+
14+
// check "development build" in Unity build settings and
15+
// that method call will result in app crash
16+
public static void Assertion([NotNull] object message)
17+
{
18+
Debug.LogAssertion(message.ToString());
19+
// TODO log to crashlytics in release
20+
if (Debug.isDebugBuild)
21+
{
22+
// TODO breakpoint
23+
Application.Quit();
24+
}
25+
else if (!EditorApplication.isPlaying)
26+
{
27+
// TODO consider just throwing with unhandled exception leads to crash set in Unity
28+
//Crashlytics.RecordCustomException(string name, string reason, StackTrace stackTrace);
29+
//Crashlytics.RecordCustomException(string name, string reason, string stackTraceString);
30+
}
31+
if (EditorApplication.isPlaying)
32+
{
33+
Debug.Break();
34+
}
35+
}
36+
37+
}
38+
39+
}

Core/Utils/Log/LogProxy.cs

Lines changed: 0 additions & 32 deletions
This file was deleted.

Core/Utils/Log/UnityLogImpl.cs

Lines changed: 0 additions & 20 deletions
This file was deleted.

Core/Utils/Network/RequestManager.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@
22
// http://www.apache.org/licenses/LICENSE-2.0
33
using System;
44
using System.Net;
5+
using Assets.Plugins.DeepLabs.Core.Utils.Log;
56
using Assets.Sources.NativePlatform;
6-
using Assets.Sources.Util.Log;
77
using Assets.Sources.Util.Network.Requests;
88
using RestSharp;
99

@@ -77,7 +77,7 @@ public void AddRequest<TResponseType>(RequestBase<TResponseType> request, Action
7777
{
7878
if (request.Error != null)
7979
{
80-
LogProxy.Log("Request error (custom error-handling logic is set): " + request.Error);
80+
Lc.D("Request error (custom error-handling logic is set): " + request.Error);
8181
}
8282
onFinish(response, response.Error);
8383
});

Core/Utils/Network/Requests/RequestBase.cs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
using System;
44
using System.Collections.Generic;
55
using System.Linq;
6-
using Assets.Sources.Util.Log;
6+
using Assets.Plugins.DeepLabs.Core.Utils.Log;
77
using RestSharp;
88

99
namespace Assets.Sources.Util.Network.Requests
@@ -130,7 +130,7 @@ private IRestRequest BuildRequest()
130130
var requestPath = BuildRequestPath();
131131
var requestMethodType = RequestMethodType();
132132

133-
LogProxy.Log(requestMethodType + ": " + requestPath);
133+
Lc.D(requestMethodType + ": " + requestPath);
134134

135135
var request = new RestRequest(requestPath, requestMethodType);
136136
request.RequestFormat = DataFormat.Json;
@@ -145,7 +145,7 @@ private IRestRequest BuildRequest()
145145
var body = request.Parameters.FirstOrDefault(p => p.Type == ParameterType.RequestBody);
146146
if (body != null)
147147
{
148-
LogProxy.Log("Request body: " + body.Value);
148+
Lc.D("Request body: " + body.Value);
149149
}
150150
}
151151

@@ -166,11 +166,11 @@ private void OnResponse(IRestResponse<TResponseType> response)
166166
errorMessage = response.Content;
167167
}
168168
Error = new RequestError(errorMessage, statusCode, response.ResponseStatus);
169-
LogProxy.Log(Error.ToString());
169+
Lc.D(Error.ToString());
170170
}
171171
else
172172
{
173-
LogProxy.Log("Response data: " + response.Content);
173+
Lc.D("Response data: " + response.Content);
174174
}
175175
}
176176

Core/Utils/Statistics/AbstractLogSender.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@
33
using System;
44
using System.Collections.Generic;
55
using System.Threading;
6+
using Assets.Plugins.DeepLabs.Core.Utils.Log;
67
using Assets.Sources.Util.Concurrent;
7-
using Assets.Sources.Util.Log;
88

99
namespace Assets.Sources.Util.Statistics
1010
{
@@ -47,7 +47,7 @@ private void ExceptionRun()
4747
}
4848
catch (Exception e)
4949
{
50-
LogProxy.LogError(e.ToString());
50+
Lc.Assertion(e);
5151
}
5252
}
5353

0 commit comments

Comments
 (0)