Coder Social home page Coder Social logo

Support Log.wtf about timber HOT 13 CLOSED

CaptnBlubber avatar CaptnBlubber commented on August 11, 2024
Support Log.wtf

from timber.

Comments (13)

AndrewReitz avatar AndrewReitz commented on August 11, 2024 5

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

from timber.

JakeWharton avatar JakeWharton commented on August 11, 2024

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.

from timber.

JakeWharton avatar JakeWharton commented on August 11, 2024

It crashes your app.

https://github.com/android/platform_frameworks_base/blob/master/services/java/com/android/server/am/ActivityManagerService.java#L9874

from timber.

donnfelker avatar donnfelker commented on August 11, 2024

Updated link as above link is dead: https://github.com/android/platform_frameworks_base/blob/master/services/core/java/com/android/server/am/ActivityManagerService.java#L11853

from timber.

donnfelker avatar donnfelker commented on August 11, 2024

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?

from timber.

JakeWharton avatar JakeWharton commented on August 11, 2024

Yes.

Why do you explicitly choose to use it?

from timber.

donnfelker avatar donnfelker commented on August 11, 2024

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.

from timber.

donnfelker avatar donnfelker commented on August 11, 2024

@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?

from timber.

donnfelker avatar donnfelker commented on August 11, 2024

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

from timber.

JakeWharton avatar JakeWharton commented on August 11, 2024

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).

from timber.

donnfelker avatar donnfelker commented on August 11, 2024

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

from timber.

JakeWharton avatar JakeWharton commented on August 11, 2024

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

from timber.

donnfelker avatar donnfelker commented on August 11, 2024

from timber.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    šŸ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. šŸ“ŠšŸ“ˆšŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ā¤ļø Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.