Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Better Log system #381

Closed
davideas opened this issue Jun 4, 2017 · 0 comments
Closed

Better Log system #381

davideas opened this issue Jun 4, 2017 · 0 comments
Milestone

Comments

@davideas
Copy link
Owner

davideas commented Jun 4, 2017

Create an utility class that simplifies the use of android.util.Log by improving the call to all log methods by supplying arguments as parameters instead of creating a string.
This avoids useless memory allocations when not requested: the StringBuilder itself, the buffer and the String object. The new methods check in advance if the level is enabled and only after creates the string message with arguments.

Also, implement features like:

  • Automatic TAG corresponding to the caller class name.
  • Runtime log level without the need of props file (useful for libraries like this).
  • Method name with line number.

Should use SUPPRESS to disable all logs. For instance:

if (BuildConfig.DEBUG) {
    Log.setLevel(Level.INFO);
} else {
    Log.setLevel(Level.SUPPRESS);
}
@davideas davideas added this to the 5.0.0-rc2 milestone Jun 4, 2017
davideas added a commit that referenced this issue Jun 5, 2017
davideas added a commit that referenced this issue Jun 5, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant