-
Notifications
You must be signed in to change notification settings - Fork 126
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
1dd4750
commit f47ef0e
Showing
20 changed files
with
673 additions
and
504 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
90 changes: 90 additions & 0 deletions
90
app/src/main/java/com/espressif/espblufi/app/BlufiLog.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,90 @@ | ||
package com.espressif.espblufi.app; | ||
|
||
import android.util.Log; | ||
|
||
public class BlufiLog { | ||
private final String mTag; | ||
private Level mLevel = Level.V; | ||
|
||
/** | ||
* @param cls The tag will use simple name of the cls. | ||
*/ | ||
public BlufiLog(Class cls) { | ||
mTag = String.format("[%s]", cls.getSimpleName()); | ||
} | ||
|
||
/** | ||
* Set the print lowest level. It will set {@link Level#NIL} if the level is null. | ||
* | ||
* @param level The lowest level can print log. | ||
*/ | ||
public void setLevel(Level level) { | ||
if (level == null) { | ||
mLevel = Level.NIL; | ||
} else { | ||
mLevel = level; | ||
} | ||
} | ||
|
||
/** | ||
* Send a {@link Level#V} log message. | ||
* | ||
* @param msg The message you would like logged. | ||
*/ | ||
public void v(String msg) { | ||
if (mLevel.ordinal() <= Level.V.ordinal()) { | ||
Log.v(mTag, msg); | ||
} | ||
} | ||
|
||
/** | ||
* Send a {@link Level#V} log message. | ||
* | ||
* @param msg The message you would like logged. | ||
*/ | ||
public void d(String msg) { | ||
if (mLevel.ordinal() <= Level.D.ordinal()) { | ||
Log.d(mTag, msg); | ||
} | ||
} | ||
|
||
/** | ||
* Send a {@link Level#I} log message. | ||
* | ||
* @param msg The message you would like logged. | ||
*/ | ||
public void i(String msg) { | ||
if (mLevel.ordinal() <= Level.I.ordinal()) { | ||
Log.i(mTag, msg); | ||
} | ||
} | ||
|
||
/** | ||
* Send a {@link Level#W} log message. | ||
* | ||
* @param msg The message you would like logged. | ||
*/ | ||
public void w(String msg) { | ||
if (mLevel.ordinal() <= Level.W.ordinal()) { | ||
Log.w(mTag, msg); | ||
} | ||
} | ||
|
||
/** | ||
* Send a {@link Level#E} log message. | ||
* | ||
* @param msg The message you would like logged. | ||
*/ | ||
public void e(String msg) { | ||
if (mLevel.ordinal() <= Level.E.ordinal()) { | ||
Log.e(mTag, msg); | ||
} | ||
} | ||
|
||
/** | ||
* The level allow logged | ||
*/ | ||
public enum Level { | ||
V, D, I, W, E, NIL | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.