console logger for Android
This commit is contained in:
parent
e91303f16b
commit
ea0d1471fc
|
@ -8,6 +8,16 @@ import org.acra.config.MailSenderConfigurationBuilder;
|
|||
import org.acra.config.ToastConfigurationBuilder;
|
||||
|
||||
public class RusefiApplication extends Application {
|
||||
static {
|
||||
/**
|
||||
* We better not touch real classes in order not to trigger class loading
|
||||
*
|
||||
* Logging#LOG_CLASS_NAME
|
||||
* @see ConsoleLogger
|
||||
*/
|
||||
System.setProperty("log.className", "com.devexperts.logging.ConsoleLogger");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onCreate() {
|
||||
super.onCreate();
|
||||
|
|
|
@ -38,6 +38,7 @@ import android.view.WindowManager;
|
|||
import android.widget.EditText;
|
||||
import android.widget.TextView;
|
||||
|
||||
import com.devexperts.logging.Logging;
|
||||
import com.google.android.material.snackbar.BaseTransientBottomBar;
|
||||
import com.google.android.material.snackbar.Snackbar;
|
||||
import com.rusefi.Callable;
|
||||
|
@ -57,6 +58,7 @@ import com.rusefi.proxy.NetworkConnector;
|
|||
import com.rusefi.proxy.NetworkConnectorContext;
|
||||
|
||||
public class rusEFI extends Activity {
|
||||
private final static Logging log = Logging.getLogging(rusEFI.class);
|
||||
private static final String ACTION_USB_PERMISSION = "com.android.example.USB_PERMISSION";
|
||||
|
||||
// private static final byte REQUEST_TYPE_CLASS = 32;
|
||||
|
@ -81,6 +83,7 @@ public class rusEFI extends Activity {
|
|||
@SuppressLint("SetTextI18n")
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
log.info("onCreate");
|
||||
super.onCreate(savedInstanceState);
|
||||
setContentView(R.layout.activity_usb);
|
||||
|
||||
|
|
|
@ -0,0 +1,21 @@
|
|||
package com.devexperts.logging;
|
||||
|
||||
import java.util.LinkedHashMap;
|
||||
import java.util.Map;
|
||||
import java.util.logging.ConsoleHandler;
|
||||
import java.util.logging.Handler;
|
||||
import java.util.logging.Level;
|
||||
import java.util.logging.Logger;
|
||||
|
||||
public class ConsoleLogger extends DefaultLogging {
|
||||
@Override
|
||||
Map<String, Exception> configureLogFile(String log_file) {
|
||||
Logger root = Logger.getLogger("");
|
||||
Handler handler = new ConsoleHandler();
|
||||
handler.setFormatter(new LogFormatter());
|
||||
handler.setLevel(Level.ALL);
|
||||
root.addHandler(handler);
|
||||
|
||||
return new LinkedHashMap<>();
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue