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

Support Log.wtf #32

Closed
CaptnBlubber opened this issue Sep 16, 2014 · 13 comments
Closed

Support Log.wtf #32

CaptnBlubber opened this issue Sep 16, 2014 · 13 comments

Comments

@CaptnBlubber
Copy link

What About Supporting .wtf (Documentation: http://developer.android.com/reference/android/util/Log.html#wtf(java.lang.String, java.lang.Throwable) ) Log Levels.

@JakeWharton
Copy link
Owner

Does anyone use this log level? The documentation says that your process could outright be killed if you do. I don't think there's a lot of utility in exposing it inside Timber.

@AndrewReitz
Copy link

I was under the impression that wtf log level was a joke.

@donnfelker
Copy link

I need WTF for our project. We forked android so we control the system global setting, WTF_IS_FATAL, and we've set it to false. If I implement WTF will you accept it as a PR?

@JakeWharton
Copy link
Owner

Yes.

Why do you explicitly choose to use it?

@donnfelker
Copy link

Personally I have never used it but was convinced for this special use case that we're in with our device. We hook into the system and grab the WTF's and send them up to our servers where we actively monitor them and react to them internally. We only log extreme, definite "this should never happen" type of scenarios so we know if they actually do happen in prod. One such example would be - A new device being ships and it is not configured as we expect from the factory/etc.

@donnfelker
Copy link

@JakeWharton Would like to see what you think about this ...

WTF has an interesting implementation as it depends on this non-public method: https://github.com/android/platform_frameworks_base/blob/master/core/java/android/util/Log.java#L289

All other log levels (v/d/i/w/e) log to println_native where wtf calls this the method linked above. In the Timber#logMessage call I can implement a couple of ifs so that it calls the actual WTF methods if the priority is ASSERT so the underlying wtf implementation is called. This would take two if statements -

  1. If message is less than MAX_LOG_LENGTH
  2. If over MAX_LOG_LENGTH (within while loop)

My gut says this feels a bit hacky because we're assuming that all ASSERT's are wtf's, but I'm not sure what might be best in this scenario. Whats your opinion on it? Thoughts?

@donnfelker
Copy link

See the code above for what I'm talking about. Looking forward to feedback.

@JakeWharton
Copy link
Owner

I think what you said is fine. It is only slightly hacky, but I'm pretty comfortable with it since the levels are fixed (knock on wood) and unlikely to ever change or be expanded further (and thus necessitate more hacks).

@donnfelker
Copy link

Do we want to merge this in for a new release? Yes/No?

JakeWharton pushed a commit that referenced this issue Apr 16, 2015
@JakeWharton
Copy link
Owner

Merged to master. Need the weekend to bake the release to see if anything else needs to be included.

@donnfelker
Copy link

donnfelker commented Apr 16, 2015 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants