Enhanced debug logging for Unity, with JSON/CSV export and HTML viewer.
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
Assets
ProjectSettings
UnityPackageManager
.gitignore
LICENSE
README.md

README.md

Unity-File-Debug

Unity Version  Platform  GitHub license  GitHub release  GitHub issues  Pull Requests 

Enhanced debug logging for Unity, with file export and HTML viewer.

Why

  • Output Unity debug info to log files (csv, tsv, json, txt)
  • A nice web interface to view the log files (csv, tsv, json)
    • HTML5 (single file)
    • No external dependencies
    • Searchable via message, stacktrace, timestamp, logtype
    • Filterable by logtype
  • Be able to drop it into existing projects

How to use

  1. Import the latest release's package into your project
  2. Move the prefab Unity File Debug into your scene
  3. Setup the filepath and settings in the inspector
  4. Copy the HTML to your output path via inspector button
  5. Use Debug.Log as normal, or for more advanced usage see Tester script in Demo folder
  6. Open the UnityFileDebugViewer.html file from your log folder, browse for a log file from the top left

If you don't specify an absolute filepath, Application.persistentDataPath will be used.

HTML viewer is designed for modern browsers (chrome/firefox)

Developing

  • Fork/clone this repository
  • Open in Unity
  • Hack away

How to Customize

Custom log types

  1. Change DLogType enumeration in DebugWrapper.cs
  2. Update topLogTypes and nestedLogTypes arrays in UnityFileDebugViewer.html
  3. Update LogTypeColors css in UnityFileDebugViewer.html
  4. Update svg icons in UnityFileDebugViewer.html

No nesting in viewer

  1. Move all elements from nestedLogTypes array to topLogTypes in UnityFileDebugViewer.html

Using other log sources

The viewer supports a few different file formats

JSON format:
{
  t: '', // type
  tm: '', // time
  l: '', // log message
  s: '', // log stack trace
}
CSV header:

type,time,log,stack

TSV header:

type time log stack


Release

In the Unity Editor, click the menu option SSS/Util/Package/Unity File Debug. The UnityFileDebug.unitypackage will be in the root of this project.