diff options
Diffstat (limited to 'main/src/cgeo/geocaching/utils/Log.java')
| -rw-r--r-- | main/src/cgeo/geocaching/utils/Log.java | 13 |
1 files changed, 8 insertions, 5 deletions
diff --git a/main/src/cgeo/geocaching/utils/Log.java b/main/src/cgeo/geocaching/utils/Log.java index 6d57b75..f7f33d9 100644 --- a/main/src/cgeo/geocaching/utils/Log.java +++ b/main/src/cgeo/geocaching/utils/Log.java @@ -2,6 +2,7 @@ package cgeo.geocaching.utils; import android.os.Environment; +import java.io.BufferedWriter; import java.io.File; import java.io.FileWriter; import java.io.IOException; @@ -22,11 +23,11 @@ final public class Log { } /** - * make a non persisted copy of the debug flag from the settings for performance reasons - * + * save a copy of the debug flag from the settings for performance reasons + * * @param isDebug */ - public static void setDebugUnsaved(boolean isDebug) { + public static void setDebug(boolean isDebug) { Log.isDebug = isDebug; } @@ -100,12 +101,14 @@ final public class Log { first = false; file.delete(); } + Writer writer = null; try { - final Writer writer = new FileWriter(file, true); + writer = new BufferedWriter(new FileWriter(file, true)); writer.write(msg); - writer.close(); } catch (final IOException e) { Log.e("logToFile: cannot write to " + file, e); + } finally { + IOUtils.closeQuietly(writer); } } } |
