0

In Android Studio's logcat window it is hard to distinguish my custom log messages (Log.d, Log.e...) from the other log messages. This still happens when setting package:mine.

See the image below:

enter image description here

S. Gissel
  • 1,788
  • 2
  • 15
  • 32

1 Answers1

0

Best solution is to use Timber.

In MainApplication class set up a custom class extending Timber.Tree. Then Timber.plant it like this:

if (BuildConfig.DEBUG) {
    Timber.plant(new MyPersonalDebugTree());
} else {
    Timber.plant(new CrashReportingTree());
}

The custom Timber.Tree looks like following:

public class MyPersonalDebugTree extends Timber.DebugTree {
    @Override
    protected void log(int priority, String tag, @NonNull String message, Throwable t) {
        StringBuilder sb = new StringBuilder(message);
        sb.insert(0, "\uD83D\uDC99\uD83D\uDC99\uD83D\uDC99 - ");
        super.log(priority, tag, sb.toString(), t);
    }
}

Notice this:

sb.insert(0, "\uD83D\uDC99\uD83D\uDC99\uD83D\uDC99 - ");

It modifies your log messages and adds a prefix containing ❤️❤️❤️.

enter image description here

S. Gissel
  • 1,788
  • 2
  • 15
  • 32