├── .gitignore
├── DebugLog-Demo
├── .project
├── AndroidManifest.xml
├── assets
│ ├── ss1.jpg
│ └── ss2.jpg
├── ic_launcher-web.png
├── libs
│ └── android-support-v4.jar
├── proguard-project.txt
├── project.properties
├── res
│ ├── drawable-hdpi
│ │ └── ic_launcher.png
│ ├── drawable-mdpi
│ │ └── ic_launcher.png
│ ├── drawable-xhdpi
│ │ └── ic_launcher.png
│ ├── drawable-xxhdpi
│ │ └── ic_launcher.png
│ ├── layout
│ │ └── activity_main.xml
│ ├── menu
│ │ └── main.xml
│ ├── values-sw600dp
│ │ └── dimens.xml
│ ├── values-sw720dp-land
│ │ └── dimens.xml
│ ├── values-v11
│ │ └── styles.xml
│ ├── values-v14
│ │ └── styles.xml
│ └── values
│ │ ├── dimens.xml
│ │ ├── strings.xml
│ │ └── styles.xml
└── src
│ └── com
│ └── mustafaferhan
│ └── debuglog_demo
│ └── MainActivity.java
├── LICENSE
├── LibDebugLog
├── .project
├── AndroidManifest.xml
├── libs
│ └── android-support-v4.jar
├── proguard-project.txt
├── project.properties
├── res
│ ├── drawable-hdpi
│ │ └── ic_launcher.png
│ ├── drawable-mdpi
│ │ └── ic_launcher.png
│ ├── drawable-xhdpi
│ │ └── ic_launcher.png
│ ├── values-v11
│ │ └── styles.xml
│ ├── values-v14
│ │ └── styles.xml
│ └── values
│ │ ├── strings.xml
│ │ └── styles.xml
└── src
│ └── com
│ └── mustafaferhan
│ └── debuglog
│ └── DebugLog.java
├── README.md
└── buildvariants.png
/.gitignore:
--------------------------------------------------------------------------------
1 | # built application files
2 | *.apk
3 | *.ap_
4 |
5 | # files for the dex VM
6 | *.dex
7 |
8 | # Java class files
9 | *.class
10 |
11 | # generated files
12 | bin/
13 | gen/
14 |
15 | # Local configuration file (sdk path, etc)
16 | local.properties
17 | .directory
18 |
19 | #Eclipse specific ignores
20 | .metadata
21 | bin/**
22 | tmp/**
23 | tmp/**/*
24 | *.tmp
25 | *.bak
26 | *.swp
27 | *~.nib
28 | local.properties
29 | .classpath
30 | .settings/*
31 | .settings/
32 | .loadpath
33 | DebugLog-Demo/.idea
34 |
--------------------------------------------------------------------------------
/DebugLog-Demo/.project:
--------------------------------------------------------------------------------
1 |
2 |
3 | DebugLog-Demo
4 |
5 |
6 |
7 |
8 |
9 | com.android.ide.eclipse.adt.ResourceManagerBuilder
10 |
11 |
12 |
13 |
14 | com.android.ide.eclipse.adt.PreCompilerBuilder
15 |
16 |
17 |
18 |
19 | org.eclipse.jdt.core.javabuilder
20 |
21 |
22 |
23 |
24 | com.android.ide.eclipse.adt.ApkBuilder
25 |
26 |
27 |
28 |
29 |
30 | com.android.ide.eclipse.adt.AndroidNature
31 | org.eclipse.jdt.core.javanature
32 |
33 |
34 |
--------------------------------------------------------------------------------
/DebugLog-Demo/AndroidManifest.xml:
--------------------------------------------------------------------------------
1 |
2 |
6 |
7 |
10 |
11 |
17 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
--------------------------------------------------------------------------------
/DebugLog-Demo/assets/ss1.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/MustafaFerhan/DebugLog/3f94ab83657dbfd4afa489ee19b18d15ca957f20/DebugLog-Demo/assets/ss1.jpg
--------------------------------------------------------------------------------
/DebugLog-Demo/assets/ss2.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/MustafaFerhan/DebugLog/3f94ab83657dbfd4afa489ee19b18d15ca957f20/DebugLog-Demo/assets/ss2.jpg
--------------------------------------------------------------------------------
/DebugLog-Demo/ic_launcher-web.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/MustafaFerhan/DebugLog/3f94ab83657dbfd4afa489ee19b18d15ca957f20/DebugLog-Demo/ic_launcher-web.png
--------------------------------------------------------------------------------
/DebugLog-Demo/libs/android-support-v4.jar:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/MustafaFerhan/DebugLog/3f94ab83657dbfd4afa489ee19b18d15ca957f20/DebugLog-Demo/libs/android-support-v4.jar
--------------------------------------------------------------------------------
/DebugLog-Demo/proguard-project.txt:
--------------------------------------------------------------------------------
1 | # To enable ProGuard in your project, edit project.properties
2 | # to define the proguard.config property as described in that file.
3 | #
4 | # Add project specific ProGuard rules here.
5 | # By default, the flags in this file are appended to flags specified
6 | # in ${sdk.dir}/tools/proguard/proguard-android.txt
7 | # You can edit the include path and order by changing the ProGuard
8 | # include property in project.properties.
9 | #
10 | # For more details, see
11 | # http://developer.android.com/guide/developing/tools/proguard.html
12 |
13 | # Add any project specific keep options here:
14 |
15 | # If your project uses WebView with JS, uncomment the following
16 | # and specify the fully qualified class name to the JavaScript interface
17 | # class:
18 | #-keepclassmembers class fqcn.of.javascript.interface.for.webview {
19 | # public *;
20 | #}
21 |
--------------------------------------------------------------------------------
/DebugLog-Demo/project.properties:
--------------------------------------------------------------------------------
1 | # This file is automatically generated by Android Tools.
2 | # Do not modify this file -- YOUR CHANGES WILL BE ERASED!
3 | #
4 | # This file must be checked in Version Control Systems.
5 | #
6 | # To customize properties used by the Ant build system edit
7 | # "ant.properties", and override values to adapt the script to your
8 | # project structure.
9 | #
10 | # To enable ProGuard to shrink and obfuscate your code, uncomment this (available properties: sdk.dir, user.home):
11 | #proguard.config=${sdk.dir}/tools/proguard/proguard-android.txt:proguard-project.txt
12 |
13 | # Project target.
14 | target=android-19
15 | android.library.reference.1=../LibDebugLog
16 |
--------------------------------------------------------------------------------
/DebugLog-Demo/res/drawable-hdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/MustafaFerhan/DebugLog/3f94ab83657dbfd4afa489ee19b18d15ca957f20/DebugLog-Demo/res/drawable-hdpi/ic_launcher.png
--------------------------------------------------------------------------------
/DebugLog-Demo/res/drawable-mdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/MustafaFerhan/DebugLog/3f94ab83657dbfd4afa489ee19b18d15ca957f20/DebugLog-Demo/res/drawable-mdpi/ic_launcher.png
--------------------------------------------------------------------------------
/DebugLog-Demo/res/drawable-xhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/MustafaFerhan/DebugLog/3f94ab83657dbfd4afa489ee19b18d15ca957f20/DebugLog-Demo/res/drawable-xhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/DebugLog-Demo/res/drawable-xxhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/MustafaFerhan/DebugLog/3f94ab83657dbfd4afa489ee19b18d15ca957f20/DebugLog-Demo/res/drawable-xxhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/DebugLog-Demo/res/layout/activity_main.xml:
--------------------------------------------------------------------------------
1 |
10 |
11 |
15 |
16 |
17 |
--------------------------------------------------------------------------------
/DebugLog-Demo/res/menu/main.xml:
--------------------------------------------------------------------------------
1 |
10 |
--------------------------------------------------------------------------------
/DebugLog-Demo/res/values-sw600dp/dimens.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
7 |
8 |
9 |
--------------------------------------------------------------------------------
/DebugLog-Demo/res/values-sw720dp-land/dimens.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
7 | 128dp
8 |
9 |
10 |
--------------------------------------------------------------------------------
/DebugLog-Demo/res/values-v11/styles.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
7 |
10 |
11 |
12 |
--------------------------------------------------------------------------------
/DebugLog-Demo/res/values-v14/styles.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
8 |
11 |
12 |
13 |
--------------------------------------------------------------------------------
/DebugLog-Demo/res/values/dimens.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | 16dp
5 | 16dp
6 |
7 |
8 |
--------------------------------------------------------------------------------
/DebugLog-Demo/res/values/strings.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | DebugLog-Demo
5 | Settings
6 | You should see DDMS Logs, not here
7 |
8 |
9 |
--------------------------------------------------------------------------------
/DebugLog-Demo/res/values/styles.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
7 |
14 |
15 |
16 |
19 |
20 |
21 |
--------------------------------------------------------------------------------
/DebugLog-Demo/src/com/mustafaferhan/debuglog_demo/MainActivity.java:
--------------------------------------------------------------------------------
1 | package com.mustafaferhan.debuglog_demo;
2 |
3 | import android.app.Activity;
4 | import android.os.Bundle;
5 |
6 | import com.mustafaferhan.debuglog.DebugLog;
7 |
8 | /***
9 | * @since Mar 5, 2014 - 1:06:32 AM
10 | * @author Mustafa Ferhan Akman
11 | */
12 | public class MainActivity extends Activity {
13 |
14 | @Override
15 | protected void onCreate(Bundle savedInstanceState) {
16 | super.onCreate(savedInstanceState);
17 | setContentView(R.layout.activity_main);
18 |
19 | DebugLog.e("simple log from onCreate()");
20 |
21 | myFunc();
22 | mySecondFunc();
23 | }
24 |
25 | void myFunc(){
26 | DebugLog.e("simple log from myFunc()");
27 | }
28 |
29 | void mySecondFunc(){
30 | DebugLog.i("simple log from mySecondFunc()");
31 | }
32 |
33 | @Override
34 | protected void onResume() {
35 | super.onResume();
36 |
37 | DebugLog.v("v log");
38 | DebugLog.w("w log");
39 | DebugLog.wtf("wtf log");
40 | }
41 |
42 | }
43 |
--------------------------------------------------------------------------------
/LICENSE:
--------------------------------------------------------------------------------
1 | This is free and unencumbered software released into the public domain.
2 |
3 | Anyone is free to copy, modify, publish, use, compile, sell, or
4 | distribute this software, either in source code form or as a compiled
5 | binary, for any purpose, commercial or non-commercial, and by any
6 | means.
7 |
8 | In jurisdictions that recognize copyright laws, the author or authors
9 | of this software dedicate any and all copyright interest in the
10 | software to the public domain. We make this dedication for the benefit
11 | of the public at large and to the detriment of our heirs and
12 | successors. We intend this dedication to be an overt act of
13 | relinquishment in perpetuity of all present and future rights to this
14 | software under copyright law.
15 |
16 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
17 | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
18 | MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
19 | IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR
20 | OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
21 | ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
22 | OTHER DEALINGS IN THE SOFTWARE.
23 |
24 | For more information, please refer to
--------------------------------------------------------------------------------
/LibDebugLog/.project:
--------------------------------------------------------------------------------
1 |
2 |
3 | LibDebugLog
4 |
5 |
6 |
7 |
8 |
9 | com.android.ide.eclipse.adt.ResourceManagerBuilder
10 |
11 |
12 |
13 |
14 | com.android.ide.eclipse.adt.PreCompilerBuilder
15 |
16 |
17 |
18 |
19 | org.eclipse.jdt.core.javabuilder
20 |
21 |
22 |
23 |
24 | com.android.ide.eclipse.adt.ApkBuilder
25 |
26 |
27 |
28 |
29 |
30 | com.android.ide.eclipse.adt.AndroidNature
31 | org.eclipse.jdt.core.javanature
32 |
33 |
34 |
--------------------------------------------------------------------------------
/LibDebugLog/AndroidManifest.xml:
--------------------------------------------------------------------------------
1 |
5 |
6 |
9 |
10 |
15 |
16 |
17 |
18 |
--------------------------------------------------------------------------------
/LibDebugLog/libs/android-support-v4.jar:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/MustafaFerhan/DebugLog/3f94ab83657dbfd4afa489ee19b18d15ca957f20/LibDebugLog/libs/android-support-v4.jar
--------------------------------------------------------------------------------
/LibDebugLog/proguard-project.txt:
--------------------------------------------------------------------------------
1 | # To enable ProGuard in your project, edit project.properties
2 | # to define the proguard.config property as described in that file.
3 | #
4 | # Add project specific ProGuard rules here.
5 | # By default, the flags in this file are appended to flags specified
6 | # in ${sdk.dir}/tools/proguard/proguard-android.txt
7 | # You can edit the include path and order by changing the ProGuard
8 | # include property in project.properties.
9 | #
10 | # For more details, see
11 | # http://developer.android.com/guide/developing/tools/proguard.html
12 |
13 | # Add any project specific keep options here:
14 |
15 | # If your project uses WebView with JS, uncomment the following
16 | # and specify the fully qualified class name to the JavaScript interface
17 | # class:
18 | #-keepclassmembers class fqcn.of.javascript.interface.for.webview {
19 | # public *;
20 | #}
21 |
--------------------------------------------------------------------------------
/LibDebugLog/project.properties:
--------------------------------------------------------------------------------
1 | # This file is automatically generated by Android Tools.
2 | # Do not modify this file -- YOUR CHANGES WILL BE ERASED!
3 | #
4 | # This file must be checked in Version Control Systems.
5 | #
6 | # To customize properties used by the Ant build system edit
7 | # "ant.properties", and override values to adapt the script to your
8 | # project structure.
9 | #
10 | # To enable ProGuard to shrink and obfuscate your code, uncomment this (available properties: sdk.dir, user.home):
11 | #proguard.config=${sdk.dir}/tools/proguard/proguard-android.txt:proguard-project.txt
12 |
13 | # Project target.
14 | target=android-14
15 | android.library=true
16 |
--------------------------------------------------------------------------------
/LibDebugLog/res/drawable-hdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/MustafaFerhan/DebugLog/3f94ab83657dbfd4afa489ee19b18d15ca957f20/LibDebugLog/res/drawable-hdpi/ic_launcher.png
--------------------------------------------------------------------------------
/LibDebugLog/res/drawable-mdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/MustafaFerhan/DebugLog/3f94ab83657dbfd4afa489ee19b18d15ca957f20/LibDebugLog/res/drawable-mdpi/ic_launcher.png
--------------------------------------------------------------------------------
/LibDebugLog/res/drawable-xhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/MustafaFerhan/DebugLog/3f94ab83657dbfd4afa489ee19b18d15ca957f20/LibDebugLog/res/drawable-xhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/LibDebugLog/res/values-v11/styles.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
7 |
10 |
11 |
12 |
--------------------------------------------------------------------------------
/LibDebugLog/res/values-v14/styles.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
8 |
11 |
12 |
13 |
--------------------------------------------------------------------------------
/LibDebugLog/res/values/strings.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | LibDebugLog
4 |
5 |
6 |
--------------------------------------------------------------------------------
/LibDebugLog/res/values/styles.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
7 |
14 |
15 |
16 |
19 |
20 |
21 |
--------------------------------------------------------------------------------
/LibDebugLog/src/com/mustafaferhan/debuglog/DebugLog.java:
--------------------------------------------------------------------------------
1 | /***
2 | This is free and unencumbered software released into the public domain.
3 |
4 | Anyone is free to copy, modify, publish, use, compile, sell, or
5 | distribute this software, either in source code form or as a compiled
6 | binary, for any purpose, commercial or non-commercial, and by any
7 | means.
8 |
9 | For more information, please refer to
10 | */
11 |
12 | package com.mustafaferhan.debuglog;
13 |
14 | import android.util.Log;
15 |
16 |
17 | /**
18 | * @date 21.06.2012
19 | * @author Mustafa Ferhan Akman
20 | *
21 | * Create a simple and more understandable Android logs.
22 | * */
23 |
24 | public class DebugLog{
25 |
26 | static String className;
27 | static String methodName;
28 | static int lineNumber;
29 |
30 | private DebugLog(){
31 | /* Protect from instantiations */
32 | }
33 |
34 | public static boolean isDebuggable() {
35 | return BuildConfig.DEBUG;
36 | }
37 |
38 | private static String createLog( String log ) {
39 |
40 | StringBuffer buffer = new StringBuffer();
41 | buffer.append("[");
42 | buffer.append(methodName);
43 | buffer.append(":");
44 | buffer.append(lineNumber);
45 | buffer.append("]");
46 | buffer.append(log);
47 |
48 | return buffer.toString();
49 | }
50 |
51 | private static void getMethodNames(StackTraceElement[] sElements){
52 | className = sElements[1].getFileName();
53 | methodName = sElements[1].getMethodName();
54 | lineNumber = sElements[1].getLineNumber();
55 | }
56 |
57 | public static void e(String message){
58 | if (!isDebuggable())
59 | return;
60 |
61 | // Throwable instance must be created before any methods
62 | getMethodNames(new Throwable().getStackTrace());
63 | Log.e(className, createLog(message));
64 | }
65 |
66 | public static void i(String message){
67 | if (!isDebuggable())
68 | return;
69 |
70 | getMethodNames(new Throwable().getStackTrace());
71 | Log.i(className, createLog(message));
72 | }
73 |
74 | public static void d(String message){
75 | if (!isDebuggable())
76 | return;
77 |
78 | getMethodNames(new Throwable().getStackTrace());
79 | Log.d(className, createLog(message));
80 | }
81 |
82 | public static void v(String message){
83 | if (!isDebuggable())
84 | return;
85 |
86 | getMethodNames(new Throwable().getStackTrace());
87 | Log.v(className, createLog(message));
88 | }
89 |
90 | public static void w(String message){
91 | if (!isDebuggable())
92 | return;
93 |
94 | getMethodNames(new Throwable().getStackTrace());
95 | Log.w(className, createLog(message));
96 | }
97 |
98 | public static void wtf(String message){
99 | if (!isDebuggable())
100 | return;
101 |
102 | getMethodNames(new Throwable().getStackTrace());
103 | Log.wtf(className, createLog(message));
104 | }
105 |
106 | }
107 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | [](http://androidweekly.net/issues/issue-92)
2 |
3 | DebugLog
4 | ========
5 |
6 | Create a simple and more understandable Android logs.
7 |
8 | #Why?
9 |
10 | android.util.Log is the most usable library of the Android. But, when the app released on the market, some important information is clearly forgotten by the developer.
11 | All logs are disabled by DebugLog when the app is released.
12 |
13 | And plus, it provides more understandable DDMS logs for developers.
14 |
15 |
16 | #Usage
17 |
18 | #####Traditional android.util.Log usage:
19 | ```java
20 | public static final String TAG = "MyApp or MyClass name";
21 |
22 | void myFunc(){
23 | android.util.Log.i(TAG, "my message");
24 | }
25 | ```
26 |
27 | Generally, this logs location forgotten after first day:) if the location hasn't been defined in log message.
28 | Add **LibDebugLog** as a library to your project and you are good to go.
29 |
30 | #####DebugLog usage:
31 | ```java
32 |
33 | void myFunc(){
34 | DebugLog.e("simple log from myFunc()");
35 | }
36 |
37 | ```
38 |
39 | no tags, and no any information. Just write your logs.
40 |
41 | It shows useful data;
42 | 
43 | 
44 |
45 |
46 | ##Android Studio
47 | if you use Android Studio, all logs are disabled by DebugLog when the build variant is set 'release'
48 |
49 | 
50 |
51 | ##Eclipse
52 | if you use Eclipse, all logs are disabled by DebugLog when the generated new signed apk.
53 |
54 | #Add Your Project
55 | ##Gradle
56 |
57 | ```java
58 | repositories {
59 | maven {
60 | url "https://jitpack.io"
61 | }
62 | }
63 | ```
64 |
65 | ```java
66 | dependencies {
67 | compile 'com.github.MustafaFerhan:DebugLog:v1.0'
68 | }
69 | ```
70 |
71 | ##Maven
72 |
73 | ```java
74 |
75 | jitpack.io
76 | https://jitpack.io
77 |
78 | ```
79 |
80 | ```java
81 |
82 | com.github.MustafaFerhan
83 | DebugLog
84 | v1.0
85 |
86 | ```
87 |
88 |
89 | #Contributing
90 |
91 | Want to contribute? You are welcome!
92 |
93 | #Licence
94 | #####The Unlicense
95 | Anyone is free to copy, modify, publish, use, compile, sell, or
96 | distribute this software, either in source code form or as a compiled
97 | binary, for any purpose, commercial or non-commercial, and by any
98 | means.
99 |
100 | For more information, please refer to
101 |
--------------------------------------------------------------------------------
/buildvariants.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/MustafaFerhan/DebugLog/3f94ab83657dbfd4afa489ee19b18d15ca957f20/buildvariants.png
--------------------------------------------------------------------------------