[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[GNUnet-SVN] [taler-taler-util] 19/51: Parsing GNUNET_FORCE_LOGFILE.
From: |
gnunet |
Subject: |
[GNUnet-SVN] [taler-taler-util] 19/51: Parsing GNUNET_FORCE_LOGFILE. |
Date: |
Mon, 23 Sep 2019 22:02:10 +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 4cbf3d591ca40a650c643b1e6f361b465d487692
Author: Marcello Stanisci <address@hidden>
AuthorDate: Wed Feb 6 14:58:15 2019 +0100
Parsing GNUNET_FORCE_LOGFILE.
---
python/log/gnunet_log.py | 17 +++++++++++++++++
1 file changed, 17 insertions(+)
diff --git a/python/log/gnunet_log.py b/python/log/gnunet_log.py
index 9dc5e09..7eb6778 100755
--- a/python/log/gnunet_log.py
+++ b/python/log/gnunet_log.py
@@ -4,6 +4,7 @@
import os
import logging
+import datetime
class LogDefinition:
def __init__(self, component, forced, loglevel):
@@ -39,6 +40,7 @@ class GnunetLogger:
self.component = component
self.loglevel = None
+ self.filename = None
# Setting the *logging* loglevel in order to have the
# chance of changing the *logger* (object) loglevel along the
@@ -56,6 +58,21 @@ class GnunetLogger:
self.no_forced_definitions = False
self.__parse_definitions(os.environ.get("GNUNET_FORCE_LOG"), True)
+ if os.environ.get("GNUNET_FORCE_LOGFILE"):
+ filename =
self.parse_filename(os.environ.get("GNUNET_FORCE_LOGFILE"))
+ fh = logging.FileHandler(filename)
+ self.logger.addHandler(fh)
+
+ def parse_filename(self, filename):
+ # implement {} and [] substitution.
+ self.filename = filename.replace("{}", self.component)
+ self.filename = self.filename.replace("[]", 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"))
+ return self.filename
+
def string_to_loglevel(self, level):
level_map = {
--
To stop receiving notification emails like this one, please contact
address@hidden.
- [GNUnet-SVN] [taler-taler-util] 02/51: adding amount lib, (continued)
- [GNUnet-SVN] [taler-taler-util] 02/51: adding amount lib, gnunet, 2019/09/23
- [GNUnet-SVN] [taler-taler-util] 04/51: add talerconfig and linted amount, gnunet, 2019/09/23
- [GNUnet-SVN] [taler-taler-util] 06/51: remove old config, gnunet, 2019/09/23
- [GNUnet-SVN] [taler-taler-util] 07/51: Update "config" module (with one that implements @INLINE@)., gnunet, 2019/09/23
- [GNUnet-SVN] [taler-taler-util] 14/51: log test, gnunet, 2019/09/23
- [GNUnet-SVN] [taler-taler-util] 12/51: make map static, gnunet, 2019/09/23
- [GNUnet-SVN] [taler-taler-util] 25/51: 4453. Parsing line interval., gnunet, 2019/09/23
- [GNUnet-SVN] [taler-taler-util] 11/51: Towards a usable solution for #4453., gnunet, 2019/09/23
- [GNUnet-SVN] [taler-taler-util] 13/51: Give loglevels dedicate class + test., gnunet, 2019/09/23
- [GNUnet-SVN] [taler-taler-util] 16/51: Updating Amount from bank., gnunet, 2019/09/23
- [GNUnet-SVN] [taler-taler-util] 19/51: Parsing GNUNET_FORCE_LOGFILE.,
gnunet <=
- [GNUnet-SVN] [taler-taler-util] 26/51: 4453. Check against further fields (filename, func, lineno), gnunet, 2019/09/23
- [GNUnet-SVN] [taler-taler-util] 17/51: 4453., gnunet, 2019/09/23
- [GNUnet-SVN] [taler-taler-util] 24/51: fix filename extraction., gnunet, 2019/09/23
- [GNUnet-SVN] [taler-taler-util] 18/51: 4453., gnunet, 2019/09/23
- [GNUnet-SVN] [taler-taler-util] 20/51: 4453., gnunet, 2019/09/23
- [GNUnet-SVN] [taler-taler-util] 22/51: 4453, use regex., gnunet, 2019/09/23
- [GNUnet-SVN] [taler-taler-util] 15/51: Update amount., gnunet, 2019/09/23
- [GNUnet-SVN] [taler-taler-util] 21/51: 4453., gnunet, 2019/09/23
- [GNUnet-SVN] [taler-taler-util] 23/51: fetch caller's metadata., gnunet, 2019/09/23
- [GNUnet-SVN] [taler-taler-util] 29/51: rename function, gnunet, 2019/09/23