本文整理汇总了Java中com.orhanobut.logger.AndroidLogAdapter类的典型用法代码示例。如果您正苦于以下问题:Java AndroidLogAdapter类的具体用法?Java AndroidLogAdapter怎么用?Java AndroidLogAdapter使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
AndroidLogAdapter类属于com.orhanobut.logger包,在下文中一共展示了AndroidLogAdapter类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: onCreate
import com.orhanobut.logger.AndroidLogAdapter; //导入依赖的package包/类
@Override
public void onCreate() {
super.onCreate();
MultiDex.install(this);
Logger.addLogAdapter(new AndroidLogAdapter() {
@Override
public boolean isLoggable(int priority, String tag) {
return BuildConfig.DEBUG;
}
});
Hawk.init(getBaseContext()).build();
CalligraphyConfig.initDefault(new CalligraphyConfig.Builder()
.setDefaultFontPath("fonts/lato_regular.ttf")
.setFontAttrId(R.attr.fontPath)
.build()
);
}
示例2: onCreate
import com.orhanobut.logger.AndroidLogAdapter; //导入依赖的package包/类
@Override
public void onCreate() {
super.onCreate();
//初始化Logger
Logger.addLogAdapter(new AndroidLogAdapter());
//控制日志输出
LogUtil.LEVEL = LogUtil.VERBOSE;
context = getApplicationContext();
//初始化栈视图功能
Fragmentation.builder()
.stackViewMode(Fragmentation.BUBBLE)
.debug(BuildConfig.DEBUG)
.handleException(new ExceptionHandler() {
@Override
public void onException(Exception e) {
//处理异常
}
})
.install();
//AndroidUtilCode初始化
Utils.init(this);
}
示例3: onCreate
import com.orhanobut.logger.AndroidLogAdapter; //导入依赖的package包/类
@Override
public void onCreate() {
super.onCreate();
CrashReport.initCrashReport(getApplicationContext(), "e1a62089c6", false);
ImagePipelineConfig config = ImagePipelineConfig.newBuilder(this)
.setProgressiveJpegConfig(new SimpleProgressiveJpegConfig())
.build();
Fresco.initialize(this, config);
SDKInitializer.initialize(this);
Bmob.initialize(this, "b0cb494256d9b86fc931ca930a055b75");
Logger.addLogAdapter(new AndroidLogAdapter(){
@Override
public boolean isLoggable(int priority, String tag) {
return true;// TODO: 2017/6/5
}
});
sInstance = this;
initUser();
}
示例4: onCreate
import com.orhanobut.logger.AndroidLogAdapter; //导入依赖的package包/类
@Override
public void onCreate() {
super.onCreate();
instances = this;
//greendao
mAppComponent = DaggerAppComponent
.builder()
.appModule(new AppModule(this))
.build();
setDatabase();
//logger
if(LogUtils.isApkDebugable(this)) {
Logger.addLogAdapter(new AndroidLogAdapter());
}
//umeng analytics
MobclickAgent.setScenarioType(this, MobclickAgent.EScenarioType.E_UM_NORMAL);
SkinCompatManager.withoutActivity(this) // 基础控件换肤初始化
.addInflater(new SkinMaterialViewInflater()) // material design 控件换肤初始化[可选]
.setSkinStatusBarColorEnable(false) // 关闭状态栏换肤,默认打开[可选]
.setSkinWindowBackgroundEnable(false) // 关闭windowBackground换肤,默认打开[可选]
.loadSkin();
}
示例5: onCreate
import com.orhanobut.logger.AndroidLogAdapter; //导入依赖的package包/类
@Override
public void onCreate() {
super.onCreate();
mcontext = this;
new Thread(new Runnable() {
@Override
public void run() {
NetService.getInstance().init(cityUrl);
Logger.addLogAdapter(new AndroidLogAdapter());
}
}).start();
// Stetho.initializeWithDefaults(this);
// mRefWatcher = LeakCanary.install(mcontext);
TimeMonitorManager.getInstance().getTimeMonitor(TimeMonitorConfig
.TIME_MONITOR_ID_APPLICATION_START).recordingTimeTag("ApplicationCreated");
// DaoMaster.DevOpenHelper helper = new DaoMaster.DevOpenHelper(getAppContext(),
// "weather-db", null);
// daoMaster = new DaoMaster(helper.getWritableDatabase());
// CrashHandler crashHandler = CrashHandler.getInstance();
// crashHandler.init(this);
// crashHandler.sendPreviousReportsToServer();
}
示例6: onCreate
import com.orhanobut.logger.AndroidLogAdapter; //导入依赖的package包/类
@Override
public void onCreate() {
super.onCreate();
Logger.addLogAdapter(new AndroidLogAdapter());
if (PreferenceManager.getDefaultSharedPreferences(getApplicationContext()).
getBoolean(getString(R.string.key_pref_logging), false)) {
if (ContextCompat.checkSelfPermission(getApplicationContext(),
Manifest.permission.WRITE_EXTERNAL_STORAGE) == PackageManager.PERMISSION_GRANTED) {
Logger.addLogAdapter(new DiskLogAdapter());
} else {
PreferenceManager.getDefaultSharedPreferences(getApplicationContext()).edit()
.putBoolean(getString(R.string.key_pref_logging), false)
.apply();
}
}
Logger.log(Logger.ASSERT, null, "======Easer started======", null);
}
示例7: configure
import com.orhanobut.logger.AndroidLogAdapter; //导入依赖的package包/类
public final void configure() {
//初始化OkHttpClient
if (HH_CONFIGS.get(ConfigKeys.OKHTTP_CLIENT) == null) {
//添加interceptor
for (Interceptor interceptor : INTERCEPTORS) {
BUILDER.addInterceptor(interceptor);
}
HH_CONFIGS.put(ConfigKeys.OKHTTP_CLIENT, BUILDER.build());
}
//初始化Utils库
Utils.init((Application) HHEngine.getApplicationContext());
//初始化icon库
initIcons();
//初始化logger库
Logger.addLogAdapter(new AndroidLogAdapter());
HH_CONFIGS.put(ConfigKeys.CONFIG_READY, true);
}
示例8: initBase
import com.orhanobut.logger.AndroidLogAdapter; //导入依赖的package包/类
public static void initBase(Application application) {
instance = application;
handler = new Handler();
FormatStrategy formatStrategy = PrettyFormatStrategy.newBuilder()
.showThreadInfo(false) // (Optional) Whether to show thread info or not. Default true
.methodCount(0) // (Optional) How many method line to show. Default 2
.methodOffset(7) // (Optional) Hides internal method calls up to offset. Default 5
.build();
Logger.addLogAdapter(new AndroidLogAdapter(formatStrategy));
}
示例9: init
import com.orhanobut.logger.AndroidLogAdapter; //导入依赖的package包/类
public void init(Context context) {
Cache cache = new Cache(context.getCacheDir(), 10 * 1024 * 1024);
HttpLoggingInterceptor.Logger logger = new HttpLoggingInterceptor.Logger() {
@Override
public void log(String message) {
if (message.startsWith("{") || message.startsWith("[")) {
Logger.json(message);
} else {
Log.d("okhttp", "" + message);
}
}
};
Logger.addLogAdapter(new AndroidLogAdapter());
HttpLoggingInterceptor loggingInterceptor = new HttpLoggingInterceptor(logger);
loggingInterceptor.setLevel(HttpLoggingInterceptor.Level.BODY);
okHttpClient = new OkHttpClient.Builder()
.addInterceptor(new OAuth1SigningInterceptor())
.addInterceptor(loggingInterceptor)
.cache(cache)
.readTimeout(60, TimeUnit.SECONDS)
.writeTimeout(60, TimeUnit.SECONDS)
.build();
Gson gson = new GsonBuilder()
.setLenient()
.create();
retrofit = new Retrofit.Builder()
.baseUrl(Constants.BASE_URL)
.addConverterFactory(GsonConverterFactory.create(gson))
.client(okHttpClient)
.build();
}
示例10: MyLogger
import com.orhanobut.logger.AndroidLogAdapter; //导入依赖的package包/类
public MyLogger(@Level int i) {
LEVEL = i;
if (LEVEL != NOTHING) {
Logger.addLogAdapter(new AndroidLogAdapter());
}
if (LEVEL == ERROR) {
Logger.addLogAdapter(new DiskLogAdapter());
}
}
示例11: onCreate
import com.orhanobut.logger.AndroidLogAdapter; //导入依赖的package包/类
@Override
public void onCreate() {
super.onCreate();
/**
* 初始化日志工具
*/
Logger.addLogAdapter(new AndroidLogAdapter());
//TODO 集成:1.4、初始化数据服务SDK、保存设备信息并启动推送服务
/**
* 初始化比目数据SDK
*/
Bmob.initialize(this, "e9b559bd68461777602a46dead1b581b");
/**
* 保存设备信息,用于推送功能
*/
BmobInstallationManager.getInstance().initialize(new InstallationListener<BmobInstallation>() {
@Override
public void done(BmobInstallation bmobInstallation, BmobException e) {
if (e == null) {
Logger.i(bmobInstallation.getObjectId() + "-" + bmobInstallation.getInstallationId());
} else {
Logger.e(e.getMessage());
}
}
});
/**
* 启动推送服务
*/
BmobPush.startWork(this);
}
示例12: LoggerLog
import com.orhanobut.logger.AndroidLogAdapter; //导入依赖的package包/类
public LoggerLog() {
FormatStrategy formatStrategy = PrettyFormatStrategy.newBuilder()
.showThreadInfo(true) // (Optional) Whether to show thread info or not. Default true
.methodCount(2) // (Optional) How many method line to show. Default 2
.methodOffset(2) // (Optional) Hides internal method calls up to offset. Default 5
// .logStrategy(customLog) // (Optional) Changes the log strategy to print out. Default LogCat
// .tag("My custom tag") // (Optional) Global tag for every log. Default PRETTY_LOGGER
.build();
Logger.addLogAdapter(new AndroidLogAdapter(formatStrategy));
}
示例13: onCreate
import com.orhanobut.logger.AndroidLogAdapter; //导入依赖的package包/类
@Override
public void onCreate() {
super.onCreate();
mApplication = this;
mContext = getApplicationContext();
init();
UMShareAPI.get(this);
Logger.addLogAdapter(new AndroidLogAdapter());
Logger.addLogAdapter(new DiskLogAdapter());
}
示例14: configure
import com.orhanobut.logger.AndroidLogAdapter; //导入依赖的package包/类
public final void configure() {
Logger.addLogAdapter(new AndroidLogAdapter());
LATTE_CONFIGS.put(ConfigKeys.CONFIG_READY, true);
Utils.init(Bing.getApplicationContext());
}
示例15: onCreate
import com.orhanobut.logger.AndroidLogAdapter; //导入依赖的package包/类
@Override
public void onCreate() {
super.onCreate();
Logger.addLogAdapter(new AndroidLogAdapter());
}