Search in sources :

Example 1 with AndroidLogAdapter

use of com.orhanobut.logger.AndroidLogAdapter in project android-mdm-agent by flyve-mdm.

the class MDMAgent method onCreate.

/**
 * Called when the application is starting before any activity, service or receiver objects have been created
 */
@Override
public void onCreate() {
    super.onCreate();
    instance = this;
    UtilsCrash.configCrash(this, true);
    try {
        FormatStrategy formatStrategy = PrettyFormatStrategy.newBuilder().tag(// (Optional) Global tag for every log.
        getPackageName()).build();
        Logger.addLogAdapter(new AndroidLogAdapter(formatStrategy));
    } catch (Exception ex) {
        ex.getStackTrace();
    }
    // ( 0 != ( getApplicationInfo().flags & ApplicationInfo.FLAG_DEBUGGABLE ) );
    isDebuggable = true;
}
Also used : AndroidLogAdapter(com.orhanobut.logger.AndroidLogAdapter) FormatStrategy(com.orhanobut.logger.FormatStrategy) PrettyFormatStrategy(com.orhanobut.logger.PrettyFormatStrategy)

Example 2 with AndroidLogAdapter

use of com.orhanobut.logger.AndroidLogAdapter in project LearnApp by YouCii.

the class App method onCreate.

@Override
public void onCreate() {
    super.onCreate();
    CrashHandler.getInstance().init(this);
    // 启用LeakCanary, 正式发布时会自动失效
    LeakCanary.install(this);
    Logger.addLogAdapter(new AndroidLogAdapter());
    initOkGo();
}
Also used : AndroidLogAdapter(com.orhanobut.logger.AndroidLogAdapter)

Example 3 with AndroidLogAdapter

use of com.orhanobut.logger.AndroidLogAdapter in project ttdj by soonphe.

the class MainActivity method doBusiness.

@Override
public void doBusiness(Context mContext) {
    if (Build.VERSION.SDK_INT >= 23) {
        new RxPermissions(getContext()).request(Manifest.permission.ACCESS_FINE_LOCATION, Manifest.permission.ACCESS_COARSE_LOCATION, Manifest.permission.READ_PHONE_STATE, Manifest.permission.WRITE_EXTERNAL_STORAGE).subscribe(granded -> {
            if (granded) {
            } else {
                Toast("请先授予应用相关权限");
                mOperation.showBasicDialog(R.string.error, R.string.grant_permission, (dialog, which) -> {
                    // Intent intent = new Intent(Settings.ACTION_WIRELESS_SETTINGS);    //飞行模式,无线网和网络设置界面
                    // 跳转位置服务界面
                    Intent intent = new Intent(Settings.ACTION_LOCATION_SOURCE_SETTINGS);
                    startActivity(intent);
                });
            }
        });
    }
    Logger.addLogAdapter(new AndroidLogAdapter());
    Logger.d("___________________hello");
// CrashReport.initCrashReport(getApplicationContext());
// CrashReport.testJavaCrash();
// DaoMaster.DevOpenHelper devOpenHelper = new DaoMaster.DevOpenHelper(getApplicationContext(), "lenve.db", null);
// DaoMaster daoMaster = new DaoMaster(devOpenHelper.getWritableDb());
// DaoSession daoSession = daoMaster.newSession();
// 
// VideoClassDao videoClassDao=daoSession.getVideoClassDao();
// 
// VideoClass user = new VideoClass();
// videoClassDao.insert(user);
}
Also used : RxPermissions(com.tbruyelle.rxpermissions2.RxPermissions) AndroidLogAdapter(com.orhanobut.logger.AndroidLogAdapter) Intent(android.content.Intent)

Example 4 with AndroidLogAdapter

use of com.orhanobut.logger.AndroidLogAdapter in project 91Pop by DanteAndroid.

the class AppLogger method initLogger.

public static void initLogger() {
    FormatStrategy formatStrategy = PrettyFormatStrategy.newBuilder().showThreadInfo(false).methodCount(0).methodOffset(5).build();
    Logger.addLogAdapter(new AndroidLogAdapter(formatStrategy) {

        @Override
        public boolean isLoggable(int priority, String tag) {
            return BuildConfig.DEBUG;
        }
    });
}
Also used : AndroidLogAdapter(com.orhanobut.logger.AndroidLogAdapter) FormatStrategy(com.orhanobut.logger.FormatStrategy) PrettyFormatStrategy(com.orhanobut.logger.PrettyFormatStrategy)

Example 5 with AndroidLogAdapter

use of com.orhanobut.logger.AndroidLogAdapter in project AndLang by wugemu.

the class BaseLangApplication method initData.

// private RefWatcher setupLeakCanary() {
// if (LeakCanary.isInAnalyzerProcess(this)) {
// return RefWatcher.DISABLED;
// }
// return LeakCanary.install(this);
// }
// public static RefWatcher getRefWatcher(Context context) {
// BaseLangApplication leakApplication = (BaseLangApplication) context.getApplicationContext();
// return leakApplication.refWatcher;
// }
private void initData() {
    mApp = this;
    // 程序错误日志信息收集
    logDir = Environment.getExternalStorageDirectory().getPath() + "/sudian/crash/";
    AppCrashHandler crashHandler = AppCrashHandler.getInstance();
    crashHandler.init(getApplicationContext());
    Logger.addLogAdapter(new AndroidLogAdapter());
    initImageLoad();
    LogUtil.e("0.0", "版本号:V" + VersionUtil.getVersionName(BaseLangApplication.this));
    // 最大化防止应用crash  需要在清单中注册DebugSafeModeTipActivity
    installCockroach();
}
Also used : AppCrashHandler(com.example.test.andlang.log.AppCrashHandler) AndroidLogAdapter(com.orhanobut.logger.AndroidLogAdapter)

Aggregations

AndroidLogAdapter (com.orhanobut.logger.AndroidLogAdapter)7 FormatStrategy (com.orhanobut.logger.FormatStrategy)4 PrettyFormatStrategy (com.orhanobut.logger.PrettyFormatStrategy)4 DiskLogAdapter (com.orhanobut.logger.DiskLogAdapter)2 Intent (android.content.Intent)1 AppCrashHandler (com.example.test.andlang.log.AppCrashHandler)1 CsvFormatStrategy (com.orhanobut.logger.CsvFormatStrategy)1 RxPermissions (com.tbruyelle.rxpermissions2.RxPermissions)1 HashMap (java.util.HashMap)1