本文整理匯總了Java中com.orhanobut.logger.Logger.addLogAdapter方法的典型用法代碼示例。如果您正苦於以下問題:Java Logger.addLogAdapter方法的具體用法?Java Logger.addLogAdapter怎麽用?Java Logger.addLogAdapter使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類com.orhanobut.logger.Logger
的用法示例。
在下文中一共展示了Logger.addLogAdapter方法的10個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: onCreate
import com.orhanobut.logger.Logger; //導入方法依賴的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.Logger; //導入方法依賴的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.Logger; //導入方法依賴的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: initBase
import com.orhanobut.logger.Logger; //導入方法依賴的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));
}
示例5: init
import com.orhanobut.logger.Logger; //導入方法依賴的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();
}
示例6: MyLogger
import com.orhanobut.logger.Logger; //導入方法依賴的package包/類
public MyLogger(@Level int i) {
LEVEL = i;
if (LEVEL != NOTHING) {
Logger.addLogAdapter(new AndroidLogAdapter());
}
if (LEVEL == ERROR) {
Logger.addLogAdapter(new DiskLogAdapter());
}
}
示例7: onCreate
import com.orhanobut.logger.Logger; //導入方法依賴的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);
}
示例8: LoggerLog
import com.orhanobut.logger.Logger; //導入方法依賴的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));
}
示例9: configure
import com.orhanobut.logger.Logger; //導入方法依賴的package包/類
public final void configure() {
Logger.addLogAdapter(new AndroidLogAdapter());
LATTE_CONFIGS.put(ConfigKeys.CONFIG_READY, true);
Utils.init(Bing.getApplicationContext());
}
示例10: onCreate
import com.orhanobut.logger.Logger; //導入方法依賴的package包/類
@Override
public void onCreate() {
super.onCreate();
Logger.addLogAdapter(new AndroidLogAdapter());
}