Skip to content

Commit

Permalink
Merge pull request #30 from orhanobut/oo/settings-fix
Browse files Browse the repository at this point in the history
method count bug fix
  • Loading branch information
orhanobut committed May 25, 2015
2 parents 8ef1e6b + 522d44d commit 5abbc15
Show file tree
Hide file tree
Showing 7 changed files with 15 additions and 9 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ Logger provides :

### Gradle
```groovy
compile 'com.orhanobut:logger:1.8'
compile 'com.orhanobut:logger:1.9'
```

### Current Log system
Expand Down
3 changes: 1 addition & 2 deletions app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,5 @@ android {
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile 'com.android.support:appcompat-v7:21.0.3'
// compile project(':logger')
compile 'com.orhanobut:logger:1.5'
compile project(':logger')
}
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);

Logger.init("test").hideThreadInfo().setMethodCount(40);
Logger.init("test").hideThreadInfo().setMethodCount(0);

printNormalLog();
printPretty();
Expand All @@ -27,7 +27,6 @@ void printNormalLog() {
Log.v(TAG, "i = 0 + 1");
Log.v(TAG, Dummy.JSON_WITH_NO_LINE_BREAK);
Log.v("test", Dummy.JSON_WITH_LINE_BREAK);

}

void printPretty() {
Expand All @@ -45,6 +44,8 @@ void printPretty() {
Logger.json(Dummy.SMALL_SON_WITH_NO_LINE_BREAK);

Logger.d("test");

Logger.t("TEST", 3).d("asdfasdf");
}

void test2() {
Expand Down
4 changes: 2 additions & 2 deletions gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@
# org.gradle.parallel=true

#VERSION_NAME=1.0-SNAPSHOT
VERSION_NAME=1.8
VERSION_CODE=9
VERSION_NAME=1.9
VERSION_CODE=10
GROUP=com.orhanobut

POM_DESCRIPTION=Simple,pretty and powerful log
Expand Down
3 changes: 1 addition & 2 deletions logger/src/main/java/com/orhanobut/logger/Logger.java
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@
public final class Logger {

private static final Printer printer = new LoggerPrinter();
private static final int DEFAULT_METHOD_COUNT = 2;
private static final String DEFAULT_TAG = "PRETTYLOGGER";

//no instance
Expand All @@ -35,7 +34,7 @@ public static Settings init(String tag) {
}

public static Printer t(String tag) {
return printer.t(tag, DEFAULT_METHOD_COUNT);
return printer.t(tag, printer.getSettings().getMethodCount());
}

public static Printer t(int methodCount) {
Expand Down
5 changes: 5 additions & 0 deletions logger/src/main/java/com/orhanobut/logger/LoggerPrinter.java
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,11 @@ public Settings init(String tag) {
return settings;
}

@Override
public Settings getSettings() {
return settings;
}

@Override
public Printer t(String tag, int methodCount) {
if (tag != null) {
Expand Down
2 changes: 2 additions & 0 deletions logger/src/main/java/com/orhanobut/logger/Printer.java
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@ public interface Printer {

Settings init(String tag);

Settings getSettings();

void d(String message, Object... args);

void e(String message, Object... args);
Expand Down

0 comments on commit 5abbc15

Please sign in to comment.