like in Timber too formatting of the message happe...
# announcements
w
like in Timber too formatting of the message happens at the very end.
Copy code
private void prepareLog(int priority, Throwable t, String message, Object... args) {
      // Consume tag even when message is not loggable so that next message is correctly tagged.
      String tag = getTag();

      if (!isLoggable(tag, priority)) {
        return;
      }
      if (message != null && message.length() == 0) {
        message = null;
      }
      if (message == null) {
        if (t == null) {
          return; // Swallow message if it's null and there's no throwable.
        }
        message = getStackTraceString(t);
      } else {
        if (args != null && args.length > 0) {
          message = formatMessage(message, args);
        }
        if (t != null) {
          message += "\n" + getStackTraceString(t);
        }
      }

      log(priority, tag, message, t);
    }
a
hehe, so I guess I still don't know how your framework works ^^ Is this SDK yours or do you use a logging-library?
w
This my sdk, so not using any library
a
alright, and what is the job of
TLogger
?
w
TLogger is interface so when you initalize the sdk you can provide TLogger implementation and you can access all the logs happening in SDK.
So SDK just use TLogger to log messages if there is an implementation provided by consumer logs are given back to that implemenation otherwise no logging is happening
Of course there is wrapper in between taking all the calls if no implementation is provided not doing anything otherwise giving it to implementation provided by cosumer
a
so
TLogger
just writes the whole message into a file for example? does it do any manipluation to the message?
w
TLogger is just an interface, devs implementing it can do whatever the want. Like in our test app we implement it with a Logger which writes to both console and a file in debug mode