[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[GNUnet-SVN] [taler-taler-util] 23/51: fetch caller's metadata.
From: |
gnunet |
Subject: |
[GNUnet-SVN] [taler-taler-util] 23/51: fetch caller's metadata. |
Date: |
Mon, 23 Sep 2019 22:02:14 +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 ef5fe40103b7656d38c0e2e538dc1d0147f83790
Author: Marcello Stanisci <address@hidden>
AuthorDate: Wed Feb 6 18:28:35 2019 +0100
fetch caller's metadata.
---
python/log/gnunet_log.py | 6 ++++++
python/log/test.py | 4 +++-
2 files changed, 9 insertions(+), 1 deletion(-)
diff --git a/python/log/gnunet_log.py b/python/log/gnunet_log.py
index 1f619ff..55b5080 100755
--- a/python/log/gnunet_log.py
+++ b/python/log/gnunet_log.py
@@ -6,6 +6,7 @@ import os
import re
import logging
import datetime
+import inspect
class LogDefinition:
def __init__(self, component, filename, function, loglevel, forced):
@@ -95,6 +96,11 @@ class GnunetLogger:
self.loglevel = loglevel
def log(self, message, message_loglevel):
+ caller_frame = inspect.stack()[1]
+
+ filename = inspect.getfile(caller_frame[0])
+ lineno = caller_frame.lineno
+ function = caller_frame.function
# Ordinary case (level setup + nothing forced).
if self.loglevel and self.no_forced_definitions:
diff --git a/python/log/test.py b/python/log/test.py
index 8467c51..763ef38 100755
--- a/python/log/test.py
+++ b/python/log/test.py
@@ -4,6 +4,9 @@ from gnunet_log import GnunetLogger as GL
import os
import sys
+# TODO
+import unittest
+
# 1st test _without_ GNUNET_FORCE_LOG being defined.
print("Testing with GNUNET_FORCE_LOG *unset*")
if os.environ.get("GNUNET_FORCE_LOG"):
@@ -63,4 +66,3 @@ 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.
- [GNUnet-SVN] [taler-taler-util] 16/51: Updating Amount from bank., (continued)
- [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, 2019/09/23
- [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 <=
- [GNUnet-SVN] [taler-taler-util] 29/51: rename function, gnunet, 2019/09/23
- [GNUnet-SVN] [taler-taler-util] 30/51: Testing env var GNUNET_LOG., gnunet, 2019/09/23
- [GNUnet-SVN] [taler-taler-util] 32/51: 4453. Testing mixed situation,, gnunet, 2019/09/23
- [GNUnet-SVN] [taler-taler-util] 37/51: fix after file rename, gnunet, 2019/09/23
- [GNUnet-SVN] [taler-taler-util] 38/51: 4453. Test GNUNET_FORCE_LOGFILE., gnunet, 2019/09/23
- [GNUnet-SVN] [taler-taler-util] 50/51: Make tests work again., gnunet, 2019/09/23
- [GNUnet-SVN] [taler-taler-util] 33/51: 4453. Test manual loglevel setup and nonforced env., gnunet, 2019/09/23
- [GNUnet-SVN] [taler-taler-util] 27/51: syntax, gnunet, 2019/09/23
- [GNUnet-SVN] [taler-taler-util] 34/51: 4453. Test for GNUNET_LOG and GNUNET_FORCE_LOG both defined., gnunet, 2019/09/23
- [GNUnet-SVN] [taler-taler-util] 39/51: Log: fix line interval parsing (care about one number case.), gnunet, 2019/09/23