diff options
| author | Jules Aguillon | 2023-07-19 23:28:33 +0200 |
|---|---|---|
| committer | Jules Aguillon | 2023-07-19 23:30:58 +0200 |
| commit | 8b2c07c9cbb783149bfa58c2d375472d87aa2e57 (patch) | |
| tree | 6c8eb924b519fad4a21c86dbc596fa6580827a23 /srcs/juloo.keyboard2/Logs.java | |
| parent | 458e17bf31c9ef6b4dfadd56dd0c0dfb709eb32c (diff) | |
| download | unexpected-keyboard-8b2c07c9cbb783149bfa58c2d375472d87aa2e57.tar.gz unexpected-keyboard-8b2c07c9cbb783149bfa58c2d375472d87aa2e57.zip | |
Refactor: Centralize logging in a static class
This new class will help write more logs. The LogPrinter is no longer
created everytime the keyboard is opened.
An error log is added if failing to load the custom extra keys.
Diffstat (limited to 'srcs/juloo.keyboard2/Logs.java')
| -rw-r--r-- | srcs/juloo.keyboard2/Logs.java | 34 |
1 files changed, 34 insertions, 0 deletions
diff --git a/srcs/juloo.keyboard2/Logs.java b/srcs/juloo.keyboard2/Logs.java new file mode 100644 index 0000000..ee44e21 --- /dev/null +++ b/srcs/juloo.keyboard2/Logs.java @@ -0,0 +1,34 @@ +package juloo.keyboard2; + +import android.util.Log; +import android.util.LogPrinter; +import android.view.inputmethod.EditorInfo; +import org.json.JSONException; + +public final class Logs +{ + static final String TAG = "juloo.keyboard2"; + + static LogPrinter _debug_logs = null; + + public static void set_debug_logs(boolean d) + { + _debug_logs = d ? new LogPrinter(Log.DEBUG, TAG) : null; + } + + public static void debug_startup_input_view(EditorInfo info, Config conf) + { + if (_debug_logs == null) + return; + info.dump(_debug_logs, ""); + if (info.extras != null) + _debug_logs.println("extras: "+info.extras.toString()); + _debug_logs.println("swapEnterActionKey: "+conf.swapEnterActionKey); + _debug_logs.println("actionLabel: "+conf.actionLabel); + } + + public static void err_load_custom_extra_keys(JSONException e) + { + Log.e(TAG, "Failed to read custom extra keys from preferences", e); + } +} |
