Use getClass().getSimpleName() as logging tag

This commit is contained in:
stefan-niedermann 2019-10-08 23:45:02 +02:00
parent 8ed007e19d
commit 7b1a8987df
5 changed files with 15 additions and 15 deletions

View file

@ -199,7 +199,7 @@ public class NotesListViewActivity extends AppCompatActivity implements ItemAdap
try { // to get current account from SingleAccountHelper try { // to get current account from SingleAccountHelper
selectAccount(SingleAccountHelper.getCurrentSingleSignOnAccount(getApplicationContext()).name); selectAccount(SingleAccountHelper.getCurrentSingleSignOnAccount(getApplicationContext()).name);
Log.v("Notes", "NextcloudRequest account: " + localAccount); Log.v(getClass().getSimpleName(), "NextcloudRequest account: " + localAccount);
} catch (NextcloudFilesAppAccountNotFoundException e) { } catch (NextcloudFilesAppAccountNotFoundException e) {
e.printStackTrace(); e.printStackTrace();
} catch (NoCurrentAccountSelectedException e) { } catch (NoCurrentAccountSelectedException e) {
@ -583,7 +583,7 @@ public class NotesListViewActivity extends AppCompatActivity implements ItemAdap
db.deleteNoteAndSync((dbNote).getId()); db.deleteNoteAndSync((dbNote).getId());
adapter.remove(dbNote); adapter.remove(dbNote);
refreshLists(); refreshLists();
Log.v("Note", "Item deleted through swipe ----------------------------------------------"); Log.v(getClass().getSimpleName(), "Item deleted through swipe ----------------------------------------------");
Snackbar.make(swipeRefreshLayout, R.string.action_note_deleted, Snackbar.LENGTH_LONG) Snackbar.make(swipeRefreshLayout, R.string.action_note_deleted, Snackbar.LENGTH_LONG)
.setAction(R.string.action_undo, (View v) -> { .setAction(R.string.action_undo, (View v) -> {
db.addNoteAndSync(dbNote.getAccountId(), dbNote); db.addNoteAndSync(dbNote.getAccountId(), dbNote);
@ -741,7 +741,7 @@ public class NotesListViewActivity extends AppCompatActivity implements ItemAdap
super.onActivityResult(requestCode, resultCode, data); super.onActivityResult(requestCode, resultCode, data);
AccountImporter.onActivityResult(requestCode, resultCode, data, this, (SingleSignOnAccount account) -> { AccountImporter.onActivityResult(requestCode, resultCode, data, this, (SingleSignOnAccount account) -> {
Log.v("Notes", "Added account: " + "name:" + account.name + ", " + account.url + ", userId" + account.userId); Log.v(getClass().getSimpleName(), "Added account: " + "name:" + account.name + ", " + account.url + ", userId" + account.userId);
db.addAccount(account.url, account.userId, account.name); db.addAccount(account.url, account.userId, account.name);
selectAccount(account.name); selectAccount(account.name);
clickHeader(); clickHeader();
@ -801,7 +801,7 @@ public class NotesListViewActivity extends AppCompatActivity implements ItemAdap
.load(R.mipmap.ic_launcher) .load(R.mipmap.ic_launcher)
.apply(RequestOptions.circleCropTransform()) .apply(RequestOptions.circleCropTransform())
.into(this.currentAccountImage); .into(this.currentAccountImage);
e.printStackTrace(); Log.w(getClass().getSimpleName(), "Tried to update username in drawer, but localAccount was null");
} }
} }

View file

@ -37,7 +37,7 @@ public class PreferencesFragment extends PreferenceFragment {
final SwitchPreference wifiOnlyPref = (SwitchPreference) findPreference(getString(R.string.pref_key_wifi_only)); final SwitchPreference wifiOnlyPref = (SwitchPreference) findPreference(getString(R.string.pref_key_wifi_only));
wifiOnlyPref.setOnPreferenceChangeListener((Preference preference, Object newValue) -> { wifiOnlyPref.setOnPreferenceChangeListener((Preference preference, Object newValue) -> {
Boolean syncOnWifiOnly = (Boolean) newValue; Boolean syncOnWifiOnly = (Boolean) newValue;
Log.v("Notes", "syncOnWifiOnly: " + syncOnWifiOnly); Log.v(getClass().getSimpleName(), "syncOnWifiOnly: " + syncOnWifiOnly);
return true; return true;
}); });
} }

View file

@ -306,7 +306,7 @@ public class NoteSQLiteOpenHelper extends SQLiteOpenHelper {
private List<DBNote> getNotesCustom(long accountId, @NonNull String selection, @NonNull String[] selectionArgs, @Nullable String orderBy, @Nullable String limit) { private List<DBNote> getNotesCustom(long accountId, @NonNull String selection, @NonNull String[] selectionArgs, @Nullable String orderBy, @Nullable String limit) {
SQLiteDatabase db = getReadableDatabase(); SQLiteDatabase db = getReadableDatabase();
if (selectionArgs.length > 2) { if (selectionArgs.length > 2) {
Log.v("Note", selection + " ---- " + selectionArgs[0] + " " + selectionArgs[1] + " " + selectionArgs[2]); Log.v(getClass().getSimpleName(), selection + " ---- " + selectionArgs[0] + " " + selectionArgs[1] + " " + selectionArgs[2]);
} }
Cursor cursor = db.query(table_notes, columns, selection, selectionArgs, null, null, orderBy, limit); Cursor cursor = db.query(table_notes, columns, selection, selectionArgs, null, null, orderBy, limit);
List<DBNote> notes = new ArrayList<>(); List<DBNote> notes = new ArrayList<>();

View file

@ -101,7 +101,7 @@ public class NoteServerSyncHelper {
try { try {
this.localAccount = db.getLocalAccountByAccountName(SingleAccountHelper.getCurrentSingleSignOnAccount(appContext).name); this.localAccount = db.getLocalAccountByAccountName(SingleAccountHelper.getCurrentSingleSignOnAccount(appContext).name);
notesClient = new NotesClient(appContext); notesClient = new NotesClient(appContext);
Log.v("Notes", "NextcloudRequest account: " + localAccount); Log.v(getClass().getSimpleName(), "NextcloudRequest account: " + localAccount);
} catch (NextcloudFilesAppAccountNotFoundException | NoCurrentAccountSelectedException e) { } catch (NextcloudFilesAppAccountNotFoundException | NoCurrentAccountSelectedException e) {
e.printStackTrace(); e.printStackTrace();
} }
@ -127,11 +127,11 @@ public class NoteServerSyncHelper {
} else { } else {
notesClient.updateAccount(); notesClient.updateAccount();
} }
Log.v("Notes", "NextcloudRequest account: " + localAccount); Log.v(getClass().getSimpleName(), "NextcloudRequest account: " + localAccount);
} catch (NextcloudFilesAppAccountNotFoundException | NoCurrentAccountSelectedException e) { } catch (NextcloudFilesAppAccountNotFoundException | NoCurrentAccountSelectedException e) {
e.printStackTrace(); e.printStackTrace();
} }
Log.v("Note", "Reinstanziation NotesClient because of SSO acc changed"); Log.v(getClass().getSimpleName(), "Reinstanziation NotesClient because of SSO acc changed");
} }
@Override @Override

View file

@ -78,11 +78,11 @@ public class NotesClient {
this.context = context; this.context = context;
try { try {
SingleSignOnAccount ssoAccount = SingleAccountHelper.getCurrentSingleSignOnAccount(context); SingleSignOnAccount ssoAccount = SingleAccountHelper.getCurrentSingleSignOnAccount(context);
Log.v("Notes", "NextcloudRequest account: " + ssoAccount.name); Log.v(getClass().getSimpleName(), "NextcloudRequest account: " + ssoAccount.name);
mNextcloudAPI = new NextcloudAPI(context, ssoAccount, new GsonBuilder().create(), new NextcloudAPI.ApiConnectedListener() { mNextcloudAPI = new NextcloudAPI(context, ssoAccount, new GsonBuilder().create(), new NextcloudAPI.ApiConnectedListener() {
@Override @Override
public void onConnected() { public void onConnected() {
Log.v("Notes", "SSO API connected"); Log.v(getClass().getSimpleName(), "SSO API connected");
} }
@Override @Override
@ -101,11 +101,11 @@ public class NotesClient {
} }
try { try {
SingleSignOnAccount ssoAccount = SingleAccountHelper.getCurrentSingleSignOnAccount(context); SingleSignOnAccount ssoAccount = SingleAccountHelper.getCurrentSingleSignOnAccount(context);
Log.v("Notes", "NextcloudRequest account: " + ssoAccount.name); Log.v(getClass().getSimpleName(), "NextcloudRequest account: " + ssoAccount.name);
mNextcloudAPI = new NextcloudAPI(context, ssoAccount, new GsonBuilder().create(), new NextcloudAPI.ApiConnectedListener() { mNextcloudAPI = new NextcloudAPI(context, ssoAccount, new GsonBuilder().create(), new NextcloudAPI.ApiConnectedListener() {
@Override @Override
public void onConnected() { public void onConnected() {
Log.v("Notes", "SSO API connected"); Log.v(getClass().getSimpleName(), "SSO API connected");
} }
@Override @Override
@ -194,9 +194,9 @@ public class NotesClient {
StringBuilder result = new StringBuilder(); StringBuilder result = new StringBuilder();
try { try {
Log.v("Notes", "NextcloudRequest: " + nextcloudRequest.toString()); Log.v(getClass().getSimpleName(), "NextcloudRequest: " + nextcloudRequest.toString());
InputStream inputStream = mNextcloudAPI.performNetworkRequest(nextcloudRequest); InputStream inputStream = mNextcloudAPI.performNetworkRequest(nextcloudRequest);
Log.v("Notes", "NextcloudRequest: " + nextcloudRequest.toString()); Log.v(getClass().getSimpleName(), "NextcloudRequest: " + nextcloudRequest.toString());
BufferedReader rd = new BufferedReader(new InputStreamReader(inputStream)); BufferedReader rd = new BufferedReader(new InputStreamReader(inputStream));
String line; String line;
while ((line = rd.readLine()) != null) { while ((line = rd.readLine()) != null) {