gnunet-svn
[Top][All Lists]
Advanced

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

[GNUnet-SVN] [taler-taler-util] 20/51: 4453.


From: gnunet
Subject: [GNUnet-SVN] [taler-taler-util] 20/51: 4453.
Date: Mon, 23 Sep 2019 22:02:11 +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 3c42d73724a3ccbf22c7cf542b20b67fab3e6548
Author: Marcello Stanisci <address@hidden>
AuthorDate: Wed Feb 6 15:12:27 2019 +0100

    4453.
    
    Fix and test GNUNET_FORCE_LOGFILE.
---
 python/log/gnunet_log.py | 8 ++++----
 python/log/test.py       | 8 ++++++++
 2 files changed, 12 insertions(+), 4 deletions(-)

diff --git a/python/log/gnunet_log.py b/python/log/gnunet_log.py
index 7eb6778..9c1c976 100755
--- a/python/log/gnunet_log.py
+++ b/python/log/gnunet_log.py
@@ -66,11 +66,11 @@ class GnunetLogger:
     def parse_filename(self, filename):
         # implement {} and [] substitution.
         self.filename = filename.replace("{}", self.component)
-        self.filename = self.filename.replace("[]", os.getpid())
+        self.filename = self.filename.replace("[]", str(os.getpid()))
         now = datetime.datetime.now()
-        self.filename = self.filaneme.replace("%Y", now.strftime("%Y"))
-        self.filename = self.filaneme.replace("%m", now.strftime("%m"))
-        self.filename = self.filaneme.replace("%d", now.strftime("%d"))
+        self.filename = self.filename.replace("%Y", now.strftime("%Y"))
+        self.filename = self.filename.replace("%m", now.strftime("%m"))
+        self.filename = self.filename.replace("%d", now.strftime("%d"))
         return self.filename
 
     def string_to_loglevel(self, level):
diff --git a/python/log/test.py b/python/log/test.py
index 2cfaff0..76a7c1a 100755
--- a/python/log/test.py
+++ b/python/log/test.py
@@ -46,3 +46,11 @@ os.environ["GNUNET_LOG"] = 
"gnunetish-python-logging;;;;ERROR"
 gl = GL("gnunetish-python-logging")
 gl.log("I am a WARNING message and I should *not* get displayed", gl.WARNING)
 gl.log("I am a ERROR message and I should get displayed", gl.ERROR)
+
+print("Testing with GNUNET_FORCE_LOGFILE set to /tmp/{}.log")
+del os.environ["GNUNET_LOG"]
+os.environ["GNUNET_FORCE_LOGFILE"] = 
"/tmp/{}-pid_[]-year_%Y-month_%m-day_%d.log"
+gl = GL("gnunetish-python-logging")
+gl.log("I'm a ERROR message, and should go to 
/tmp/{}-[]-year_%Y-month_%m-day_%d.log", gl.ERROR)
+gl.log("I'm a DEBUG message, and should *not* go to 
/tmp/{}-pid_[]-year_%Y-month_%m-day_%d.log (& console)", gl.DEBUG)
+

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



reply via email to

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