package com.dailystudio.app;

import android.app.Application;
import android.content.Context;

import com.dailystudio.GlobalContextWrapper;
import com.dailystudio.development.Logger;
import com.dailystudio.BuildConfig;

public class DevBricksApplication extends Application {

	@Override
	public void onCreate() {
		super.onCreate();

		final Context appContext = getApplicationContext();

		GlobalContextWrapper.bindContext(appContext);

		checkAndSetDebugEnabled();
	}
	
	@Override
	public void onTerminate() {
		final Context appContext = getApplicationContext();

		GlobalContextWrapper.unbindContext(appContext);

		super.onTerminate();
	}

	private void checkAndSetDebugEnabled() {
		boolean handled = false;

		if (Logger.isDebugSuppressed()
				|| Logger.isPackageDebugSuppressed(getPackageName())) {
			Logger.setDebugEnabled(false);

			handled = true;
		}

		if (Logger.isDebugForced()
				|| Logger.isPackageDebugForced(getPackageName())) {
			Logger.setDebugEnabled(true);

			handled = true;
		}

		if (!handled) {
			Logger.setDebugEnabled(isDebugBuild());
		}

		Logger.setSecureDebugEnabled(isDebugBuild());
	}

	protected boolean isDebugBuild() {
		return BuildConfig.DEBUG;
	}

}

@@ -460,16 +460,122 @@
 abled();
+%0A%0A%09%09Logger.debug(%22current application is running in %5B%25s%5D mode%22,%0A%09%09%09%09isDebugBuild() ? %22debug%22 : %22release%22);
 %0A%09%7D%0A%09%0A%09@

add debug log in DevBrickApplication to indicate the current compile mode of the application;