Catégorie : Android

In some applications, I need to store my logs in a file aside of traditional logcat. For this, I am making use of Timber library. Because I don’t want to make my device full of logs, I wanted to use circular log files so that I can control the maximum amount of bytes taken by log data. To achieve this, I will use java Logger API to implement a new Timber.Tree. I also want some feature like log formatting and filtering.

/** * Constructs a {@code Logger} object with the supplied name and resource * bundle name; {@code notifyParentHandlers} is set to {@code true}. * <p/>* Notice : Loggers use a naming hierarchy. Thus "z.x.y" is a child of "z.x". * * @param name the name of this logger, may be {@code null} for anonymous * loggers. */MyLogger(String name) { super(name, null); }

This is one of the Fragment I am creating. We can see the @Inject constructor with @Inject lateinit var that shows that this object is injectable by dagger. It is also implementing Step to be used by StepperLayout and implements another interface.