gnunet-svn
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[GNUnet-SVN] [taler-taler-util] 25/51: 4453. Parsing line interval.


From: gnunet
Subject: [GNUnet-SVN] [taler-taler-util] 25/51: 4453. Parsing line interval.
Date: Mon, 23 Sep 2019 22:02:16 +0200

This is an automated email from the git hooks/post-receive script.

ng0 pushed a commit to branch master
in repository taler-util.

commit 6eda1f9ad6fe894d2d47b89cf534c1cba9f9e3cc
Author: Marcello Stanisci <address@hidden>
AuthorDate: Wed Feb 6 18:52:42 2019 +0100

    4453.  Parsing line interval.
---
 python/log/gnunet_log.py | 18 +++++++++++++++---
 1 file changed, 15 insertions(+), 3 deletions(-)

diff --git a/python/log/gnunet_log.py b/python/log/gnunet_log.py
index ca8e598..748fb82 100755
--- a/python/log/gnunet_log.py
+++ b/python/log/gnunet_log.py
@@ -9,14 +9,25 @@ import datetime
 import inspect
 
 class LogDefinition:
-    def __init__(self, component, filename, function, loglevel, forced):
+    def __init__(self, component, filename, function, line_interval, loglevel, 
forced):
         self.forced = forced
         self.component = ".*" if "" == component else component
         self.filename = ".*" if "" == filename else filename
         self.function = ".*" if "" == function else function
-        # string here, comes from env after all.
+        self.line_interval = self.__parse_line_interval(line_interval)
+
+        # string here
         self.loglevel = loglevel
 
+    def __parse_line_interval(self, line_interval):
+        interval_re = "^([0-9]+)(-([0-9]+))?$"
+        match = re.match(interval_re, line_interval)
+        if match:
+            return dict(min=match.group(1), max=match.group(3))
+    
+        # just match every line if bad interval was provided.
+        return dict(min=0, max=float("inf"))
+
 class GnunetLoglevel:
     def __init__(self, string, level, function):
         self.string = string
@@ -37,7 +48,7 @@ class GnunetLogger:
     COMPONENT_IDX = 0
     FILENAME_IDX = 1
     FUNCTION_IDX = 2
-    # From line [-to line] missing.
+    LINE_INTERVAL = 3
     LEVEL_IDX = 4
 
     def __init__(self, component):
@@ -153,6 +164,7 @@ class GnunetLogger:
             definition = 
LogDefinition(gfl_split_split[GnunetLogger.COMPONENT_IDX],
                                        
gfl_split_split[GnunetLogger.FILENAME_IDX],
                                        
gfl_split_split[GnunetLogger.FUNCTION_IDX],
+                                       
gfl_split_split[GnunetLogger.LINE_INTERVAL],
                                        gfl_split_split[GnunetLogger.LEVEL_IDX],
                                        forced)
 

-- 
To stop receiving notification emails like this one, please contact
address@hidden.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]