UberLogger – a replacement Unity console and logging framework

I’ve been using Unity for a few years now and have developed a deep and unhealthy love for it. As a game development framework it’s easily the most expressive and flexible system I’ve ever used, in 20 years of making games.

However, as with most things, there’s the odd bit of friction that could be smoothed over, and one of the joys of Unity is that it allows you to address them when you want to. I’ve developed a couple of such things over the years, which I intend on releasing freely to the community.

First up is a replacement logging system for Unity. Unity’s built-in logging system and console are great – being able to click on logs to select game objects, viewing callstacks, etc are incredibly handy features. But I found myself wanting more. Specifically:

  • Debug channels. When you’re trying to ship a game debug messages can get very spammy, and make it difficult to sift out the signal from the noise; at the same time those spammy messages can often be useful for tracking down rare bugs. Debug channels allow you to categorise your messages as ‘loading timings’, ‘weapon debugging’, etc, and limit your view to a particular channel, allowing you to keep all your messages without being overwhelmed by them.
  • Filtering out stack frames from the callstack. It’s not uncommon to want to create your own debug layer to manipulate your logging before it hits Unity. Unfortunately, by default your new methods appear in the callstack, and the source of the error is shown to be your own debug method, which is annoying – you want some way to remove elements from the callstack.
  • Inline source view. You see a bug and you want to quickly see the source code around one part of the stack frame, without necessarily jumping into your text editor.
  • A modular system to allow different backends to process logs. I want to be able to write my own file logger, or my own in-game console, and have full access to the callstack, etc.
  • Timestamps! I want to see when a log happened.
  • A more compressed view; Unity’s console uses space somewhat inefficiently, using two lines of text for every log.
  • An in-game console. Sure, much of the time I’m working in the Unity editor, but sometimes I want to see my messages on my target device.

UberLogger addresses all of these issues and some more. It’s a drop-in replacement for the default logging framework, so no code changes are needed – Debug.Log, etc, all just work, though if you want to use features like channels there are some new methods.

In the editor it looks like this:

UberConsoleEditor

And in game it looks like this:

UberConsoleGame

It uses an MIT license, so if you’ve got any features to add send me a message (or a pull request). And if you find it useful, let me know!

Simon

Advertisements

9 thoughts on “UberLogger – a replacement Unity console and logging framework

  1. Pocram

    Hello Simon,

    This is just what I needed, thank you!

    However, when I installed your plugin I noticed that Debug.DrawRay and Debug.DrawLine were no longer working. I made a simple edit to the end of Debug.cs , but can not create a pull request since Bitbucket won’t let me log in. You can find the code here:

    http://cspad.com/17nb

    Reply
  2. Pingback: UberAudio – an improved audio workflow for Unity | Nerdgasm

  3. Gavin

    Would it be possible to add a “collapse” feature like the default Unity console? That is often really useful.
    Also, the colours don’t seem to be the way they are intended. I’m on Unity 5.4.0f3 (pro skin) and the whole colour scheme seems too saturated. Is that a known issue? I guess maybe it just needs an updated skin?

    Reply
    1. bbbscarter Post author

      Hi! I’ll have a look at the collapse feature – shouldn’t be too hard.

      As for the colours – I’ve not had access to the pro skin of Unity for a while. Could you lob me a screenshot so I can take a look?

      Ta!

      Simon

      Reply
      1. Gavin

        PM’ed you with an image. Happy to work with you on that. I forgot to say that UberLogger looks awesome and I can’t wait to start using it fully. Thanks for putting it together! 🙂
        Gav

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s