本文整理了Java中com.orhanobut.logger.Logger.addLogAdapter()
方法的一些代码示例,展示了Logger.addLogAdapter()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Logger.addLogAdapter()
方法的具体详情如下:
包路径:com.orhanobut.logger.Logger
类名称:Logger
方法名:addLogAdapter
暂无
代码示例来源:origin: orhanobut/logger
Log.d("error", "There is a crash somewhere or any warning");
Logger.addLogAdapter(new AndroidLogAdapter());
Logger.d("message");
.build();
Logger.addLogAdapter(new AndroidLogAdapter(formatStrategy));
Logger.addLogAdapter(new AndroidLogAdapter() {
@Override public boolean isLoggable(int priority, String tag) {
return BuildConfig.DEBUG;
Logger.addLogAdapter(new DiskLogAdapter());
.build();
Logger.addLogAdapter(new AndroidLogAdapter(formatStrategy));
Logger.i("no thread info and method info");
.tag("MyTag")
.build();
Logger.addLogAdapter(new AndroidLogAdapter(formatStrategy));
代码示例来源:origin: huntermr/FastAndroid
@Override
public void onCreate() {
super.onCreate();
mInstance = this;
Logger.addLogAdapter(new AndroidLogAdapter());
}
代码示例来源:origin: 121880399/QuickMvp
@Override
public void isLogAble(boolean isLog) {
Logger.addLogAdapter(new AndroidLogAdapter(){
@Override
public boolean isLoggable(int priority, String tag) {
return isLog;
}
});
}
代码示例来源:origin: glumes/AndroidOpenGLTutorial
@Override
public void onCreate() {
super.onCreate();
initTimeber();
Logger.addLogAdapter(new AndroidLogAdapter());
}
代码示例来源:origin: glumes/AndroidOpenGLTutorial
@Override
public void onCreate() {
super.onCreate();
initTimeber();
Logger.addLogAdapter(new AndroidLogAdapter());
}
代码示例来源:origin: hasancse91/Android-Development-Course
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_movie_list);
ButterKnife.bind(this);
Logger.addLogAdapter(new AndroidLogAdapter());
//Send GET request to server to fetch movie list AND load them into RecyclerView
getMovieListFromServer();
}
代码示例来源:origin: hasancse91/Android-Development-Course
public static void createNotification(String title, String message, String activity, int notificationId, Context context) throws ClassNotFoundException {
Intent intent = new Intent(context, Class.forName(activity));
intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
// int requestCode = 0;
PendingIntent pendingIntent = PendingIntent.getActivity(context, notificationId, intent, PendingIntent.FLAG_ONE_SHOT);
Uri sound = RingtoneManager.getDefaultUri(RingtoneManager.TYPE_NOTIFICATION);
NotificationCompat.Builder noBuilder = new NotificationCompat.Builder(context)
.setSmallIcon(R.drawable.ic_notifications_black_24dp)
.setContentTitle(title)
.setContentText(message)
.setAutoCancel(true)
.setContentIntent(pendingIntent)
.setSound(sound);
NotificationManager notificationManager = (NotificationManager)context.getSystemService(Context.NOTIFICATION_SERVICE);
notificationManager.notify(notificationId, noBuilder.build()); //0 = ID of notification
Logger.addLogAdapter(new AndroidLogAdapter());
Logger.d("Notification created");
}
}
代码示例来源:origin: renyuneyun/Easer
@Override
public void onCreate() {
super.onCreate();
Logger.addLogAdapter(new AndroidLogAdapter());
if (SettingsHelper.logging(this)) {
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();
}
}
startService(new Intent(this, ActivityLogService.class));
Logger.log(Logger.ASSERT, null, "======Easer started======", null);
}
}
代码示例来源:origin: hasancse91/Android-Development-Course
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_movie_list);
ButterKnife.bind(this);
Logger.addLogAdapter(new AndroidLogAdapter());
progressDialog = new ProgressDialog(this);
progressDialog.setTitle("Loading");
progressDialog.setMessage("Movie list loading from server. Please wait...");
if(Util.isInternetAvailable(this)){
//Send GET request to server to fetch movie list AND load them into RecyclerView
progressDialog.show();
getMovieListFromServer();
} else
Toast.makeText(this, "Check your internet", Toast.LENGTH_LONG).show();
swipeRefreshLayout.setOnRefreshListener(new SwipeRefreshLayout.OnRefreshListener() {
@Override
public void onRefresh() {
//when internet is available and user pull to refresh
//Send GET request to server to fetch movie list AND load them into RecyclerView
if(Util.isInternetAvailable(getApplicationContext()))
getMovieListFromServer();
else {
swipeRefreshLayout.setRefreshing(false);
Toast.makeText(getApplicationContext(), "Check your internet", Toast.LENGTH_LONG).show();
}
}
});
}
代码示例来源:origin: byhieg/easyweather
@Override
public void run() {
NetService.getInstance().init(cityUrl);
Logger.addLogAdapter(new AndroidLogAdapter());
}
}).start();
代码示例来源:origin: XunMengWinter/Now
@Override
public void onCreate() {
super.onCreate();
sApp = this;
Fresco.initialize(getApplicationContext());
Realm.init(getApplicationContext());
Logger.addLogAdapter(new AndroidLogAdapter() {
@Override
public boolean isLoggable(int priority, @Nullable String tag) {
if (!BuildConfig.DEBUG) {
return false;
}
return super.isLoggable(priority, tag);
}
});
}
代码示例来源:origin: liuyanggithub/SuperMvp
@Override
public void onCreate() {
super.onCreate();
//初始化日志工具
Logger.addLogAdapter(new AndroidLogAdapter() {
@Override public boolean isLoggable(int priority, String tag) {
return BuildConfig.DEBUG;
}
});
instance = this;
// this.enabledStrictMode();
ToastUtils.register(this);
//LeakCanary检测OOM
LeakCanary.install(this);
//初始化日志输出工具
CrashHandler.init(new CrashHandler(getApplicationContext()));
/**
* 如果存在SD卡则将缓存写入SD卡,否则写入手机内存
*/
if (getApplicationContext().getExternalCacheDir() != null && isExistSDCard()) {
cacheDir = getApplicationContext().getExternalCacheDir().toString();
}
else {
cacheDir = getApplicationContext().getCacheDir().toString();
}
}
代码示例来源:origin: wind0ws/rxbus2
@Override
public void onCreate() {
super.onCreate();
FormatStrategy formatStrategy = PrettyFormatStrategy.newBuilder()
.tag("RxBus2")
.build();
Logger.addLogAdapter(new AndroidLogAdapter(formatStrategy) {
@Override
public boolean isLoggable(int priority, String tag) {
return BuildConfig.DEBUG && super.isLoggable(priority, tag);
}
});
//set MAIN THREAD for @RxSubscribe annotation
RxBus.setMainScheduler(AndroidSchedulers.mainThread());
//OR
// EventThread.setMainThreadScheduler(AndroidSchedulers.mainThread());
//This option is optional. Using this only if you want to output RxBus log
RxBus.setLogger(new RxLogger());
// RxBus.config(AndroidSchedulers.mainThread(),new RxLogger());//this method is removed in latest version.
}
}
代码示例来源:origin: sunfusheng/Gank.IO
@Override
public void onCreate() {
super.onCreate();
AppUtil.init(this);
PrettyFormatStrategy strategy = PrettyFormatStrategy.newBuilder()
.tag(getString(R.string.app_name))
.showThreadInfo(false)
.build();
AndroidLogAdapter logAdapter = new AndroidLogAdapter(strategy);
Logger.addLogAdapter(logAdapter);
Schedulers.io().createWorker().schedule(() -> songTi = Typeface.createFromAsset(getAssets(), "SongTi.TTF"));
}
}
代码示例来源:origin: 121880399/QuickMvp
@Override
public void setGlobalTag(String tag) {
FormatStrategy formatStrategy= PrettyFormatStrategy.newBuilder()
.tag(tag).build();
Logger.clearLogAdapters();
Logger.addLogAdapter(new AndroidLogAdapter(formatStrategy));
}
}
代码示例来源:origin: AmazMod/AmazMod
public static void init() {
PrettyFormatStrategy strategy = PrettyFormatStrategy.newBuilder()
.showThreadInfo(false)
.methodCount(0)
.methodOffset(0)
.tag(Constants.TAG)
.build();
AndroidLogAdapter androidLogAdapter = new AndroidLogAdapter(strategy);
com.orhanobut.logger.Logger.addLogAdapter(androidLogAdapter);
}
代码示例来源:origin: AriesHoo/FastLib
/**
* 初始化
*
* @param tag
* @param isDebug
* @param builder
*/
public static void init(String tag, final boolean isDebug, PrettyFormatStrategy.Builder builder) {
LoggerManager.TAG = tag;
setDebug(isDebug);
if (builder == null) {
builder = PrettyFormatStrategy.newBuilder()
.methodCount(3);
}
builder.tag(TAG);
Logger.addLogAdapter(new AndroidLogAdapter(builder.build()) {
@Override
public boolean isLoggable(int priority, String tag) {
return isDebug;
}
});
}
代码示例来源:origin: wutq/AndroidModuleDemo
/**
* 初始化日志打印框架
*/
private void initLogger() {
FormatStrategy formatStrategy = PrettyFormatStrategy.newBuilder()
.showThreadInfo(false) //(可选)是否显示线程信息。 默认值为true
.methodCount(2) //(可选)要显示的方法行数。 默认2
.methodOffset(7) //(可选)设置调用堆栈的函数偏移值,0的话则从打印该Log的函数开始输出堆栈信息,默认是0
.logStrategy(new LogcatLogStrategy()) //(可选)更改要打印的日志策略。 默认LogCat
.tag("AMD") //(可选)每个日志的全局标记。 默认PRETTY_LOGGER
.build();
Logger.addLogAdapter(new AndroidLogAdapter(formatStrategy) {
@Override
public boolean isLoggable(int priority, String tag) {
//DEBUG模式下不打印LOG
return BuildConfig.DEBUG;
}
});
}
代码示例来源:origin: lytsing/weibo
@Override
public void onCreate() {
super.onCreate();
Logger.addLogAdapter(new AndroidLogAdapter());
setWeiboApplication(this);
mOauth2AccessToken = Session.restore(sWeiboApplication);
int memClass = ((ActivityManager) sWeiboApplication.getSystemService(
Context.ACTIVITY_SERVICE)).getMemoryClass();
// Use 1/8th of the available memory for this memory cache.
int cacheSize = 1024 * 1024 * memClass / 8;
mImageLoader = new ImageLoader(getRequestQueue(), new BitmapLruCache(cacheSize));
// set the max number of concurrent network connections, default is 4
AjaxCallback.setNetworkLimit(8);
// set the max number of icons (image width <= 50) to be cached in
// memory, default is 20
BitmapAjaxCallback.setIconCacheLimit(40);
// set the max number of images (image width > 50) to be cached in
// memory, default is 20
BitmapAjaxCallback.setCacheLimit(40);
// set the max size of an image to be cached in memory, default is 1600
// pixels (ie. 400x400)
BitmapAjaxCallback.setPixelLimit(400 * 400);
// set the max size of the memory cache, default is 1M pixels (4MB)
BitmapAjaxCallback.setMaxPixelLimit(2000000);
}
代码示例来源:origin: yiwent/Mobike
private void initMyApplication() {
//tencent bugly
CrashReport.initCrashReport(getApplicationContext(), "e1a62089c6", false);
//Fresco
ImagePipelineConfig config = ImagePipelineConfig.newBuilder(this)
.setProgressiveJpegConfig(new SimpleProgressiveJpegConfig())
.build();
Fresco.initialize(this, config);
//baidu map sdk
SDKInitializer.initialize(this);
//Bmob
Bmob.initialize(this, "b0cb494256d9b86fc931ca930a055b75");
//Logger
Logger.addLogAdapter(new AndroidLogAdapter(){
@Override
public boolean isLoggable(int priority, String tag) {
return true;// TODO: 2017/6/5
}
});
//locail use data
initUser();
}
内容来源于网络,如有侵权,请联系作者删除!