diff options
author | Alessandro Ghedini <al3xbio@gmail.com> | 2012-11-03 16:15:11 +0100 |
---|---|---|
committer | Alessandro Ghedini <al3xbio@gmail.com> | 2012-11-03 16:15:11 +0100 |
commit | 1f6f24308e96040962794c5a9ffd81597b5e072a (patch) | |
tree | 7d719e21bf759d20ace53bcac13325048aa21a8c /src/utilities/logger.vala | |
parent | 87a5b11d7598fc1e5239e11972c5e03a38bbb672 (diff) |
Imported Upstream version 0.5.4upstream/0.5.4
Diffstat (limited to 'src/utilities/logger.vala')
-rw-r--r-- | src/utilities/logger.vala | 41 |
1 files changed, 0 insertions, 41 deletions
diff --git a/src/utilities/logger.vala b/src/utilities/logger.vala index 116cbcd..69310fc 100644 --- a/src/utilities/logger.vala +++ b/src/utilities/logger.vala @@ -68,10 +68,8 @@ public class Logger { ///////////////////////////////////////////////////////////////////// private static const int max_log_length = 1000000; - private static const int max_stats_length = 1000000; private static int log_length; - private static int stats_length; ///////////////////////////////////////////////////////////////////// /// Possible terminal colors. @@ -94,7 +92,6 @@ public class Logger { public static void init() { log_length = -1; - stats_length = -1; try { regex = new Regex("""(.*)\.vala(:\d+): (.*)"""); @@ -104,44 +101,6 @@ public class Logger { } ///////////////////////////////////////////////////////////////////// - /// Appends a line to the statistics file - ///////////////////////////////////////////////////////////////////// - - public static int get_statistics_size() { - if (stats_length == -1) { - var stats = GLib.FileStream.open(Paths.stats, "a"); - stats_length = (int)stats.tell(); - } - - return stats_length; - } - - public static void stats(string line) { - var stats = GLib.FileStream.open(Paths.stats, "a"); - - if (stats != null) { - if (stats_length == -1) - stats_length = (int)stats.tell(); - - string final_line = "[" + get_time() + "] " + line + "\n"; - stats.puts(final_line); - stats_length += final_line.length; - } - - if (stats_length > max_stats_length) { - string content = ""; - - try { - GLib.FileUtils.get_contents(Paths.stats, out content); - int split_index = content.index_of_char('\n', stats_length - (int)(max_stats_length*0.9)); - GLib.FileUtils.set_contents(Paths.stats, content.substring(split_index+1)); - - stats_length -= (split_index+1); - } catch (GLib.FileError e) {} - } - } - - ///////////////////////////////////////////////////////////////////// /// Appends a line to the log file ///////////////////////////////////////////////////////////////////// |