Skip to content

log: add basic utility to log to editor from native plugin

Martin Finkel requested to merge mfkl/vlc-unity:log-to-editor-from-plugin into master

Need to clarify the various logging things:

  • libvlcsharp logs (to Unity Editor console or stdout),
  • libvlc logs (_libVLC.Log += (s, e) => UnityEngine.Debug.Log(e.FormattedLog);)
  • now in-editor vlc plugin logs.

components that may want to publish logs:

  • unity users script,
  • libvlcsharp,
  • vlc unity plugin,
  • libvlc.

possible outputs:

  • Unity Editor Log Console
  • stdout,
  • log file.

solution:

  • register a log callback from UnityEngine.Debug.Log from the vlc-unity c# initialization script to the C++ vlc unity plugin.
  • expose log functions from the vlc-unity plugin (one for logging to the Unity Editor, another to log to stdout).
  • have libvlcsharp call into either of the exposed log functions (notably when an exception is thrown from a reverse callback).

https://blog.sentry.io/unity-exception-handling-a-beginners-guide/

I guess the user could want:

  • to subscribe all logs in a single call,
  • to selectively subscribe to some logs,
  • to send the libvlc logs to the editor and to send the vlc plugin logs to a file?
  • unity editor log color support, enable/disable
Edited by Martin Finkel

Merge request reports

Loading