Need help with loglifecycle?
Click the “chat” button below for chat support from the developer who created it, or find similar developers for support.

About the developer

stephanenicolas
203 Stars 26 Forks Apache License 2.0 57 Commits 6 Opened issues

Description

Logs all lifecycle methods of annotated Activities, Fragments, Services, Views, etc.

Services available

!
?

Need anything else?

Contributors list

# 18,667
Android
Groovy
Redux
rxjava-...
54 commits
# 80,036
Kotlin
Groovy
Gradle
Firebas...
2 commits

⟳ loglifecycle Maven Central

Logs all lifecycle methods of annotated activities, fragments, views, etc. on Android.

Usage

Inside your

build.gradle
file, add :
apply plugin: 'loglifecycle'

And now, annotate every

Activity
you want to see its life cycle logged in logcat :
@LogLifeCycle
public class MainActivity extends Activity {
...
}

You will see something like this in logcat :

> adb logcat | grep ⟳

D/LogLifeCycle( 4640): MainActivity [1384162984] ⟳ onCreate D/LogLifeCycle( 4640): MainActivity [1384162984] ⟳ onApplyThemeResource D/LogLifeCycle( 4640): MainActivity [1384162984] ⟳ onWindowAttributesChanged D/LogLifeCycle( 4640): MainActivity [1384162984] ⟳ onWindowAttributesChanged D/LogLifeCycle( 4640): MainActivity [1384162984] ⟳ onWindowAttributesChanged D/LogLifeCycle( 4640): MainActivity [1384162984] ⟳ onContentChanged D/LogLifeCycle( 4640): MainActivity [1384162984] ⟳ onAttachFragment D/LogLifeCycle( 4640): MainActivity$MainFragment [1384183528] ⟳ onCreate D/LogLifeCycle( 4640): MainActivity [1384162984] ⟳ onStart D/LogLifeCycle( 4640): MainActivity$MainFragment [1384183528] ⟳ onStart D/LogLifeCycle( 4640): MainActivity [1384162984] ⟳ onTitleChanged D/LogLifeCycle( 4640): MainActivity [1384162984] ⟳ onPostCreate D/LogLifeCycle( 4640): MainActivity [1384162984] ⟳ onResume D/LogLifeCycle( 4640): MainActivity$MainFragment [1384183528] ⟳ onResume D/LogLifeCycle( 4640): MainActivity [1384162984] ⟳ onPostResume D/LogLifeCycle( 4640): MainActivity [1384162984] ⟳ onAttachedToWindow D/LogLifeCycle( 4640): MainActivity [1384162984] ⟳ onWindowFocusChanged

Extra features : * release builds won't log anything, indeed the app is not modified at all in release builds. * this plugin will add only a few more bytes to your app : log statements, and the annotation class, nothing more.

Example

You will find an example app using LogLifeCycle in the repo.

How does it work ?

Thanks to * morpheus, byte code weaver for android. * AfterBurner, byte code weaving swiss army knife for Android.

Related projects

On the same principle of byte code weaving :

TODO

  • [ ] add tests

CI

Travis Build Coverage Status

License

Copyright (C) 2014 Stéphane NICOLAS

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

 http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

We use cookies. If you continue to browse the site, you agree to the use of cookies. For more information on our use of cookies please see our Privacy Policy.