[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]
[tor-commits] [nyx/master] Dropping features.log.entryDuration
commit 09bed012b7373146b1faf2321622e95670b54828
Author: Damian Johnson <atagar@xxxxxxxxxxxxxx>
Date: Thu Apr 16 08:16:47 2015 -0700
Dropping features.log.entryDuration
This is a config option that let the user set a TTL for how long we keep log
entries. This is in addition to a 'maximum number of entries' limitation.
Did anyone use this? Did anyone even know it existed? Probably not - just
pointless complexity.
---
nyx/log_panel.py | 43 +++++--------------------------------------
nyxrc.sample | 4 ----
2 files changed, 5 insertions(+), 42 deletions(-)
diff --git a/nyx/log_panel.py b/nyx/log_panel.py
index e691b29..ff64c78 100644
--- a/nyx/log_panel.py
+++ b/nyx/log_panel.py
@@ -45,7 +45,6 @@ CONFIG = conf.config_dict('nyx', {
'features.log_file': '',
'features.log.showDateDividers': True,
'features.log.showDuplicateEntries': False,
- 'features.log.entryDuration': 7,
'features.log.max_lines_per_entry': 6,
'features.log.prepopulate': True,
'features.log.prepopulateReadLimit': 5000,
@@ -341,7 +340,8 @@ class LogPanel(panel.Panel, threading.Thread, logging.Handler):
# crops events that are either too old, or more numerous than the caching size
- self._trim_events(self.msg_log)
+ if len(self.msg_log) > CONFIG['cache.log_panel.size']:
+ del self.msg_log[CONFIG['cache.log_panel.size']:]
def set_duplicate_visability(self, is_visible):
"""
@@ -393,7 +393,9 @@ class LogPanel(panel.Panel, threading.Thread, logging.Handler):
with self.vals_lock:
self.msg_log.insert(0, event)
- self._trim_events(self.msg_log)
+
+ if len(self.msg_log) > CONFIG['cache.log_panel.size']:
+ del self.msg_log[CONFIG['cache.log_panel.size']:]
# notifies the display that it has new content
@@ -1043,38 +1045,3 @@ class LogPanel(panel.Panel, threading.Thread, logging.Handler):
self._title_args = (list(self.logged_events), current_pattern, width)
return panel_label
-
- def _trim_events(self, event_listing):
- """
- Crops events that have either:
- - grown beyond the cache limit
- - outlived the configured log duration
-
- Argument:
- event_listing - listing of log entries
- """
-
- cache_size = CONFIG['cache.log_panel.size']
-
- if len(event_listing) > cache_size:
- del event_listing[cache_size:]
-
- log_ttl = CONFIG['features.log.entryDuration']
-
- if log_ttl > 0:
- current_day = days_since()
-
- breakpoint = None # index at which to crop from
-
- for i in range(len(event_listing) - 1, -1, -1):
- days_since_event = current_day - days_since(event_listing[i].timestamp)
-
- if days_since_event > log_ttl:
- breakpoint = i # older than the ttl
- else:
- break
-
- # removes entries older than the ttl
-
- if breakpoint is not None:
- del event_listing[breakpoint:]
diff --git a/nyxrc.sample b/nyxrc.sample
index 1b3cc65..fadc5df 100644
--- a/nyxrc.sample
+++ b/nyxrc.sample
@@ -64,9 +64,6 @@ features.confirmQuit true
# showDuplicateEntries
# shows all log entries if true, otherwise collapses similar entries with an
# indicator for how much is being hidden
-# entryDuration
-# number of days log entries are kept before being dropped (if zero then
-# they're kept until cropped due to caching limits)
# maxLinesPerEntry
# max number of lines to display for a single log entry
# prepopulate
@@ -82,7 +79,6 @@ features.confirmQuit true
features.log.showDateDividers true
features.log.showDuplicateEntries false
-features.log.entryDuration 7
features.log.maxLinesPerEntry 6
features.log.prepopulate true
features.log.prepopulateReadLimit 5000
_______________________________________________
tor-commits mailing list
tor-commits@xxxxxxxxxxxxxxxxxxxx
https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-commits