I almost finished my first game in unity. For testing i implemented a bugreport system. It basically just prints the whole debug.log to a file. I know that this is a bad idea on how to handle bugs, but I don’t have a lot of time to put into this game no more. When there is a stacktrace the function names which represent the location of where the error occured are hashed though. Is there any way to turn this off ?
Here is the code of how I save the report:
private void OnEnable()
{
Application.logMessageReceived += Log;
}
public void Log(string logString, string stackTrace, LogType type)
{
if (type == LogType.Warning)
return;
log += "[" + System.DateTime.Now + "] " + logString + "
";
if (type == LogType.Error || type == LogType.Exception)
{
log += stackTrace + "
";
}
}
private void SaveReport()
{
//...unimportant stuff here
filename = Application.dataPath + "/BugReport" + numberOfError + "-"+ GetHashString(System.DateTime.Now.ToString())+ ".txt";
//... more unimportant stuff here
tw.WriteLine(log);
//...more unimportant stuff here
tw.Close();
Back();
}
Here is an example of a stacktrace which hashes the function names:
[16.12.2021 16:31:21] NullReferenceException
Combat.Knockback (UnityEngine.Vector2 _angle, System.Single _strength, UnityEngine.Vector2 _hitPoint) (at <44bc4ec92a024525b366363c6bd7d0c4>:0)
Combat.Damage (System.Single _amount, UnityEngine.Vector2 _angle, System.Single _strength, UnityEngine.Vector2 _hitOrigin) (at <44bc4ec92a024525b366363c6bd7d0c4>:0)
Weapon.CheckAttack () (at <44bc4ec92a024525b366363c6bd7d0c4>:0)
Weapon.AnimationActionTrigger () (at <44bc4ec92a024525b366363c6bd7d0c4>:0)
WeaponAnimationToWeapon.AnimationActionTrigger () (at <44bc4ec92a024525b366363c6bd7d0c4>:0)