summaryrefslogtreecommitdiff
path: root/src/de/blinkt/openvpn/core
diff options
context:
space:
mode:
authorArne Schwabe <arne@rfc2549.org>2013-09-21 21:48:59 +0200
committerArne Schwabe <arne@rfc2549.org>2013-09-21 21:48:59 +0200
commit9659077eb333fba01ce73d91a669b39383ec38e9 (patch)
treef97e3c0990226f0d7d8c5d6c605d8990a5be2905 /src/de/blinkt/openvpn/core
parent06fdf1246640258beba930ab9dd825e9ee48fbfe (diff)
Add ability to add icon to log messages indicating the log severity (disabled for now)
--HG-- extra : rebase_source : 8cf05112d0c781a03d1d45d5b10607290bcb6c6b
Diffstat (limited to 'src/de/blinkt/openvpn/core')
-rw-r--r--src/de/blinkt/openvpn/core/OpenVpnManagementThread.java39
-rw-r--r--src/de/blinkt/openvpn/core/VpnStatus.java10
2 files changed, 41 insertions, 8 deletions
diff --git a/src/de/blinkt/openvpn/core/OpenVpnManagementThread.java b/src/de/blinkt/openvpn/core/OpenVpnManagementThread.java
index ffa192b5..23c6cff6 100644
--- a/src/de/blinkt/openvpn/core/OpenVpnManagementThread.java
+++ b/src/de/blinkt/openvpn/core/OpenVpnManagementThread.java
@@ -224,11 +224,7 @@ public class OpenVpnManagementThread implements Runnable, OpenVPNManagement {
} else if (cmd.equals("PROXY")) {
processProxyCMD(argument);
} else if (cmd.equals("LOG")) {
- String[] args = argument.split(",",3);
- // 0 unix time stamp
- // 1 log level N,I,E etc.
- // 2 log message
- VpnStatus.logWarning( args[2]);
+ processLogMessage(argument);
} else if (cmd.equals("RSA_SIGN")) {
processSignCommand(argument);
} else {
@@ -243,7 +239,38 @@ public class OpenVpnManagementThread implements Runnable, OpenVPNManagement {
VpnStatus.logWarning("MGMT: Got unrecognized line from management:" + command);
}
}
- private void handleHold() {
+
+ private void processLogMessage(String argument) {
+ String[] args = argument.split(",",3);
+ // 0 unix time stamp
+ // 1 log level N,I,E etc.
+ /*
+ (b) zero or more message flags in a single string:
+ I -- informational
+ F -- fatal error
+ N -- non-fatal error
+ W -- warning
+ D -- debug, and
+ */
+ // 2 log message
+
+ VpnStatus.LogLevel level;
+ if (args[1].equals("I")) {
+ level = VpnStatus.LogLevel.INFO;
+ } else if (args[1].equals("W")) {
+ level = VpnStatus.LogLevel.WARNING;
+ } else if (args[1].equals("D")) {
+ level = VpnStatus.LogLevel.VERBOSE;
+ } else if (args[1].equals("F")) {
+ level = VpnStatus.LogLevel.ERROR;
+ } else {
+ level = VpnStatus.LogLevel.INFO;
+ }
+
+ VpnStatus.logMessage(level,"P:", args[2]);
+ }
+
+ private void handleHold() {
if(mReleaseHold) {
releaseHoldCmd();
} else {
diff --git a/src/de/blinkt/openvpn/core/VpnStatus.java b/src/de/blinkt/openvpn/core/VpnStatus.java
index a83714a4..c8e5a8b1 100644
--- a/src/de/blinkt/openvpn/core/VpnStatus.java
+++ b/src/de/blinkt/openvpn/core/VpnStatus.java
@@ -193,9 +193,15 @@ public class VpnStatus {
else
throw e;
}
+
}
-
- // The lint is wrong here
+
+ public LogLevel getLogLevel()
+ {
+ return mLevel;
+ }
+
+ // The lint is wrong here
@SuppressLint("StringFormatMatches")
private String getMobileInfoString(Context c) {
c.getPackageManager();