[PATCH] Show call depth with spaces in log_method_call()

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

 



Prepend log_method_call()'s output with spaces corresponding to the
depth of the current call stack, so you can see what's calling what.
---
 storage/storage_log.py |    9 +++++++--
 1 files changed, 7 insertions(+), 2 deletions(-)

diff --git a/storage/storage_log.py b/storage/storage_log.py
index 853b0cd..403f9bb 100644
--- a/storage/storage_log.py
+++ b/storage/storage_log.py
@@ -4,9 +4,14 @@ import inspect
 
 def log_method_call(d, *args, **kwargs):
     classname = d.__class__.__name__
-    methodname = inspect.stack()[1][3]
-    fmt = "%s.%s:"
+    stack = inspect.stack()
+    methodname = stack[1][3]
+
+    fmt = "%s%s.%s:"
     fmt_args = [classname, methodname]
+
+    spaces = len(stack) * ' '
+    fmt_args.insert(0, spaces)
     for arg in args:
         fmt += " %s ;"
         fmt_args.append(arg)
-- 
1.6.5.2

_______________________________________________
Anaconda-devel-list mailing list
Anaconda-devel-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/anaconda-devel-list

[Index of Archives]     [Kickstart]     [Fedora Users]     [Fedora Legacy List]     [Fedora Maintainers]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [Yosemite Photos]     [KDE Users]     [Fedora Tools]
  Powered by Linux