Bugly
This commit is contained in:
ALEXTANG
2023-04-19 17:45:25 +08:00
parent 4c78b70293
commit 4db704930d
29 changed files with 1690 additions and 0 deletions

View File

@@ -0,0 +1,3 @@
fileFormatVersion: 2
guid: a2e8f0a34b8444829a115ceca00610ee
timeCreated: 1681895814

View File

@@ -0,0 +1,14 @@
using UnityEngine;
namespace TEngine
{
[CreateAssetMenu]
public class BuglyConfig : ScriptableObject
{
public string channelId;
public string androidId;
public string androidKey;
public string iosId;
public string iosKey;
}
}

View File

@@ -0,0 +1,3 @@
fileFormatVersion: 2
guid: acf9017ac21e41dc97f7c328c0d6017f
timeCreated: 1681895834

View File

@@ -0,0 +1,88 @@
namespace TEngine
{
public class BuglyManager
{
private static BuglyManager _buglyManager;
public static BuglyManager Instance => _buglyManager ??= new BuglyManager();
public void Init(BuglyConfig config,string version = "")
{
if (config!= null)
{
ConfigDefault(config.channelId, string.IsNullOrEmpty(version) ? Version.GameVersion : version);
BuglyAgent.ConfigDebugMode (false);
#if UNITY_IPHONE || UNITY_IOS
BuglyAgent.InitWithAppId (config.iosId);
#elif UNITY_ANDROID
BuglyAgent.InitWithAppId (config.androidId);
#endif
BuglyAgent.EnableExceptionHandler();
Log.Info($"Init Bugly Successes");
}
else
{
Log.Fatal("Init Bugly Fatal buglyConfig.asset is null!");
}
}
/// <summary>
/// 启动C#异常捕获上报默认自动上报级别为LogError,那么LogError、LogException的异常日志都会自动捕获上报。
/// </summary>
public void EnableExceptionHandle()
{
BuglyAgent.EnableExceptionHandler();
}
/// <summary>
/// 设置自动上报日志信息的级别默认LogError则>=LogError的日志都会自动捕获上报。
/// </summary>
/// <param name="logLevel"></param> 日志级别
public void SetReportLogLevel(LogSeverity logLevel)
{
BuglyAgent.ConfigAutoReportLogLevel(logLevel);
}
/// <summary>
/// 设置上报的用户唯一标识,项目组可在收到服务器登录回调后调用。
/// </summary>
/// <param name="userId">用户唯一标识。</param>
public void SetUserId(string userId)
{
BuglyAgent.SetUserId(userId);
}
/// <summary>
/// 上报已捕获C#异常
/// </summary>
/// <param name="e">异常。</param>
/// <param name="description">描述。</param>
public void ReportException(System.Exception e, string description)
{
BuglyAgent.ReportException(e, description);
}
/// <summary>
/// 上报自定义错误信息
/// </summary>
/// <param name="name"></param>错误名称
/// <param name="reason"></param>错误原因
/// <param name="traceback"></param>错误堆栈
public void ReportError(string name, string reason, string traceback)
{
BuglyAgent.ReportException(name, reason, traceback);
}
/// <summary>
/// 修改默认配置
/// </summary>
/// <param name="channel"></param>渠道号
/// <param name="version"></param>版本号
/// <param name="userID"></param>用户唯一标识
/// <param name="time"></param>初始化延时
public void ConfigDefault(string channel, string version, string userID = "Unknow", long time = 0)
{
BuglyAgent.ConfigDefault(channel = null, version, userID = "Unknow", time = 0);
}
}
}

View File

@@ -0,0 +1,3 @@
fileFormatVersion: 2
guid: 94102b3b00fd4c9293073236adec064c
timeCreated: 1681895834

View File

@@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: e8eaf3c7fb019ec4393fe8d9fb91c484
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: e270de18454c9d34bb5de575c0970bcf
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 8958f050e22651e4eb88468e84e82067
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,5 @@
fileFormatVersion: 2
guid: 694411f45e4e64facb88eebfc2e1df1c
folderAsset: yes
DefaultImporter:
userData:

View File

@@ -0,0 +1,7 @@
fileFormatVersion: 2
guid: 644a9f5710e62403c94066ef9b61e775
folderAsset: yes
DefaultImporter:
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: dbe6ceb596d63f5418beb7a12d34993b
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,80 @@
fileFormatVersion: 2
guid: 6f1342562738e5d4dae6ca9bd5a4d02e
PluginImporter:
externalObjects: {}
serializedVersion: 2
iconMap: {}
executionOrder: {}
defineConstraints: []
isPreloaded: 0
isOverridable: 0
isExplicitlyReferenced: 0
validateReferences: 1
platformData:
- first:
: Any
second:
enabled: 0
settings:
Exclude Android: 0
Exclude Editor: 1
Exclude Linux64: 1
Exclude OSXUniversal: 1
Exclude Win: 1
Exclude Win64: 1
Exclude iOS: 1
- first:
Android: Android
second:
enabled: 1
settings:
CPU: ARM64
- first:
Any:
second:
enabled: 0
settings: {}
- first:
Editor: Editor
second:
enabled: 0
settings:
CPU: AnyCPU
DefaultValueInitialized: true
OS: AnyOS
- first:
Standalone: Linux64
second:
enabled: 0
settings:
CPU: None
- first:
Standalone: OSXUniversal
second:
enabled: 0
settings:
CPU: None
- first:
Standalone: Win
second:
enabled: 0
settings:
CPU: None
- first:
Standalone: Win64
second:
enabled: 0
settings:
CPU: None
- first:
iPhone: iOS
second:
enabled: 0
settings:
AddToEmbeddedBinaries: false
CPU: AnyCPU
CompileFlags:
FrameworkDependencies:
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,7 @@
fileFormatVersion: 2
guid: fb7b442d8e32443e5856838741007f70
folderAsset: yes
DefaultImporter:
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,80 @@
fileFormatVersion: 2
guid: 432060a129574479db0cfd441cdf3d69
PluginImporter:
externalObjects: {}
serializedVersion: 2
iconMap: {}
executionOrder: {}
defineConstraints: []
isPreloaded: 0
isOverridable: 0
isExplicitlyReferenced: 0
validateReferences: 1
platformData:
- first:
: Any
second:
enabled: 0
settings:
Exclude Android: 0
Exclude Editor: 1
Exclude Linux64: 1
Exclude OSXUniversal: 1
Exclude Win: 1
Exclude Win64: 1
Exclude iOS: 1
- first:
Android: Android
second:
enabled: 1
settings:
CPU: ARMv7
- first:
Any:
second:
enabled: 0
settings: {}
- first:
Editor: Editor
second:
enabled: 0
settings:
CPU: AnyCPU
DefaultValueInitialized: true
OS: AnyOS
- first:
Standalone: Linux64
second:
enabled: 0
settings:
CPU: None
- first:
Standalone: OSXUniversal
second:
enabled: 0
settings:
CPU: None
- first:
Standalone: Win
second:
enabled: 0
settings:
CPU: None
- first:
Standalone: Win64
second:
enabled: 0
settings:
CPU: None
- first:
iPhone: iOS
second:
enabled: 0
settings:
AddToEmbeddedBinaries: false
CPU: AnyCPU
CompileFlags:
FrameworkDependencies:
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,32 @@
fileFormatVersion: 2
guid: 74c10c94ce6f83b44998e0ad9de920bc
PluginImporter:
externalObjects: {}
serializedVersion: 2
iconMap: {}
executionOrder: {}
defineConstraints: []
isPreloaded: 0
isOverridable: 0
isExplicitlyReferenced: 0
validateReferences: 1
platformData:
- first:
Android: Android
second:
enabled: 1
settings: {}
- first:
Any:
second:
enabled: 0
settings: {}
- first:
Editor: Editor
second:
enabled: 0
settings:
DefaultValueInitialized: true
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,32 @@
fileFormatVersion: 2
guid: 1db231dca0f72420cb880590f799d7d5
PluginImporter:
externalObjects: {}
serializedVersion: 2
iconMap: {}
executionOrder: {}
defineConstraints: []
isPreloaded: 0
isOverridable: 0
isExplicitlyReferenced: 0
validateReferences: 1
platformData:
- first:
Android: Android
second:
enabled: 1
settings: {}
- first:
Any:
second:
enabled: 0
settings: {}
- first:
Editor: Editor
second:
enabled: 0
settings:
DefaultValueInitialized: true
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,9 @@
fileFormatVersion: 2
guid: 79531ba82725e4071861c982307805c3
folderAsset: yes
timeCreated: 1443426231
licenseType: Pro
DefaultImporter:
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,80 @@
fileFormatVersion: 2
guid: 16eaf0ec67588418783d6f5311aa71ce
PluginImporter:
externalObjects: {}
serializedVersion: 2
iconMap: {}
executionOrder: {}
defineConstraints: []
isPreloaded: 0
isOverridable: 0
isExplicitlyReferenced: 0
validateReferences: 1
platformData:
- first:
: Any
second:
enabled: 0
settings:
Exclude Android: 0
Exclude Editor: 1
Exclude Linux64: 1
Exclude OSXUniversal: 1
Exclude Win: 1
Exclude Win64: 1
Exclude iOS: 1
- first:
Android: Android
second:
enabled: 1
settings:
CPU: x86
- first:
Any:
second:
enabled: 0
settings: {}
- first:
Editor: Editor
second:
enabled: 0
settings:
CPU: AnyCPU
DefaultValueInitialized: true
OS: AnyOS
- first:
Standalone: Linux64
second:
enabled: 0
settings:
CPU: None
- first:
Standalone: OSXUniversal
second:
enabled: 0
settings:
CPU: None
- first:
Standalone: Win
second:
enabled: 0
settings:
CPU: None
- first:
Standalone: Win64
second:
enabled: 0
settings:
CPU: None
- first:
iPhone: iOS
second:
enabled: 0
settings:
AddToEmbeddedBinaries: false
CPU: AnyCPU
CompileFlags:
FrameworkDependencies:
userData:
assetBundleName:
assetBundleVariant:

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: be621fe31508b4f2ab134ee879ec97b4
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:

View File

@@ -0,0 +1,27 @@
// ----------------------------------------
//
// BuglyCallbackDelegate.cs
//
// Author:
// Yeelik, <bugly@tencent.com>
//
// Copyright (c) 2015 Bugly, Tencent. All rights reserved.
//
// ----------------------------------------
//
using UnityEngine;
using System.Collections;
public abstract class BuglyCallback
{
// The delegate of callback handler which Call the Application.RegisterLogCallback(Application.LogCallback)
/// <summary>
/// Raises the application log callback handler event.
/// </summary>
/// <param name="condition">Condition.</param>
/// <param name="stackTrace">Stack trace.</param>
/// <param name="type">Type.</param>
public abstract void OnApplicationLogCallbackHandler (string condition, string stackTrace, LogType type);
}

View File

@@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 78e76f643d1884dcab602d5fe79b08e1
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:

View File

@@ -0,0 +1,80 @@
// ----------------------------------------
//
// BuglyInit.cs
//
// Author:
// Yeelik, <bugly@tencent.com>
//
// Copyright (c) 2015 Bugly, Tencent. All rights reserved.
//
// ----------------------------------------
//
using UnityEngine;
using System.Collections;
using System.Collections.Generic;
public class BuglyInit : MonoBehaviour
{
/// <summary>
/// Your Bugly App ID. Every app has a special identifier that allows Bugly to associate error monitoring data with your app.
/// Your App ID can be found on the "Setting" page of the app you are trying to monitor.
/// </summary>
/// <example>A real App ID looks like this: 90000xxxx</example>
private const string BuglyAppID = "YOUR APP ID GOES HERE";
void Awake ()
{
// Enable the debug log print
BuglyAgent.ConfigDebugMode (false);
// Config default channel, version, user
BuglyAgent.ConfigDefault (null, null, null, 0);
// Config auto report log level, default is LogSeverity.LogError, so the LogError, LogException log will auto report
BuglyAgent.ConfigAutoReportLogLevel (LogSeverity.LogError);
// Config auto quit the application make sure only the first one c# exception log will be report, please don't set TRUE if you do not known what are you doing.
BuglyAgent.ConfigAutoQuitApplication (false);
// If you need register Application.RegisterLogCallback(LogCallback), you can replace it with this method to make sure your function is ok.
BuglyAgent.RegisterLogCallback (null);
// Init the bugly sdk and enable the c# exception handler.
BuglyAgent.InitWithAppId (BuglyAppID);
// TODO Required. If you do not need call 'InitWithAppId(string)' to initialize the sdk(may be you has initialized the sdk it associated Android or iOS project),
// please call this method to enable c# exception handler only.
BuglyAgent.EnableExceptionHandler ();
// TODO NOT Required. If you need to report extra data with exception, you can set the extra handler
BuglyAgent.SetLogCallbackExtrasHandler (MyLogCallbackExtrasHandler);
Destroy (this);
}
// Extra data handler to packet data and report them with exception.
// Please do not do hard work in this handler
static Dictionary<string, string> MyLogCallbackExtrasHandler ()
{
// TODO Test log, please do not copy it
BuglyAgent.PrintLog (LogSeverity.Log, "extra handler");
// TODO Sample code, please do not copy it
Dictionary<string, string> extras = new Dictionary<string, string> ();
extras.Add ("ScreenSolution", string.Format ("{0}x{1}", Screen.width, Screen.height));
extras.Add ("deviceModel", SystemInfo.deviceModel);
extras.Add ("deviceName", SystemInfo.deviceName);
extras.Add ("deviceType", SystemInfo.deviceType.ToString ());
extras.Add ("deviceUId", SystemInfo.deviceUniqueIdentifier);
extras.Add ("gDId", string.Format ("{0}", SystemInfo.graphicsDeviceID));
extras.Add ("gDName", SystemInfo.graphicsDeviceName);
extras.Add ("gDVdr", SystemInfo.graphicsDeviceVendor);
extras.Add ("gDVer", SystemInfo.graphicsDeviceVersion);
extras.Add ("gDVdrID", string.Format ("{0}", SystemInfo.graphicsDeviceVendorID));
extras.Add ("graphicsMemorySize", string.Format ("{0}", SystemInfo.graphicsMemorySize));
extras.Add ("systemMemorySize", string.Format ("{0}", SystemInfo.systemMemorySize));
extras.Add ("UnityVersion", Application.unityVersion);
BuglyAgent.PrintLog (LogSeverity.LogInfo, "Package extra data");
return extras;
}
}

View File

@@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: a717f6955eddf4463ad541714a1b5483
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData: