Skip to content

Commit

Permalink
feat(filog): activate and desactivate debug information
Browse files Browse the repository at this point in the history
Signed-off-by: Ivan Del Pino <idelpino@teclib.com>
  • Loading branch information
Ivan Del Pino authored and ajsb85 committed Sep 28, 2018
1 parent af5256d commit ec6af9e
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,8 @@ class MainActivity : AppCompatActivity() {
super.onCreate(savedInstanceState)
setContentView(R.layout.activity_main)

val inventoryTask = InventoryTask(this@MainActivity, "example-app-kotlin")
InventoryTask.showFILog = true
val inventoryTask = InventoryTask(this@MainActivity, "example-app-kotlin", false)
inventoryTask.getJSON( object : InventoryTask.OnTaskCompleted {
override fun onTaskSuccess(data: String) {
Log.d(LOG, data)
Expand Down
21 changes: 11 additions & 10 deletions inventory/src/main/java/org/flyve/inventory/InventoryTask.java
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,10 @@
*/
public class InventoryTask {

/**
* Set if show FILog in console
*/
public static boolean showFILog = false;
private static Handler uiHandler;

private Boolean running = false;
Expand Down Expand Up @@ -81,29 +85,26 @@ public Boolean isRunning() {
* @param context The context to be use
* @param appVersion The name of the agent
*/
public InventoryTask(Context context, String appVersion) {
public InventoryTask(Context context, String appVersion, Boolean storeResult) {
this(storeResult);
this.appVersion = appVersion;
ctx = context;

try {
FormatStrategy formatStrategy = PrettyFormatStrategy.newBuilder()
.build();
Logger.addLogAdapter(new AndroidLogAdapter(formatStrategy));
if (showFILog) {
FormatStrategy formatStrategy = PrettyFormatStrategy.newBuilder().build();
Logger.addLogAdapter(new AndroidLogAdapter(formatStrategy));
}
} catch (Exception ex) {
ex.getStackTrace();
}
}

/**
* This constructor return a Success XML or Error on asynchronous way
* @param context The context to be use
* @param appVersion The name of the agent
* @param storeResult Indicate is the result will be stored on file
*/
public InventoryTask(Context context, String appVersion, Boolean storeResult) {
this.appVersion = appVersion;
private InventoryTask(Boolean storeResult) {
this.storeResult = storeResult;
ctx = context;
}

/**
Expand Down

0 comments on commit ec6af9e

Please sign in to comment.