mirror of
https://github.com/syncthing/syncthing-android.git
synced 2024-12-23 19:31:30 +00:00
Read both stdoud and stderr for logging.
This commit is contained in:
parent
e7cc3b1a10
commit
25be5539fc
1 changed files with 4 additions and 3 deletions
|
@ -61,7 +61,8 @@ public class SyncthingRunnable implements Runnable {
|
||||||
dos.writeBytes("exit\n");
|
dos.writeBytes("exit\n");
|
||||||
dos.flush();
|
dos.flush();
|
||||||
|
|
||||||
log(process.getInputStream());
|
log(process.getInputStream(), Log.INFO);
|
||||||
|
log(process.getErrorStream(), Log.WARN);
|
||||||
|
|
||||||
ret = process.waitFor();
|
ret = process.waitFor();
|
||||||
} while (ret == 3);
|
} while (ret == 3);
|
||||||
|
@ -98,7 +99,7 @@ public class SyncthingRunnable implements Runnable {
|
||||||
*
|
*
|
||||||
* @param is The stream to log.
|
* @param is The stream to log.
|
||||||
*/
|
*/
|
||||||
private void log(final InputStream is) {
|
private void log(final InputStream is, final int priority) {
|
||||||
new Thread(new Runnable() {
|
new Thread(new Runnable() {
|
||||||
@Override
|
@Override
|
||||||
public void run() {
|
public void run() {
|
||||||
|
@ -107,7 +108,7 @@ public class SyncthingRunnable implements Runnable {
|
||||||
String line;
|
String line;
|
||||||
try {
|
try {
|
||||||
while ((line = br.readLine()) != null) {
|
while ((line = br.readLine()) != null) {
|
||||||
Log.i(TAG_NATIVE, line);
|
Log.println(priority, TAG_NATIVE, line);
|
||||||
}
|
}
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
// NOTE: This is sometimes called on shutdown, as
|
// NOTE: This is sometimes called on shutdown, as
|
||||||
|
|
Loading…
Reference in a new issue