[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 |   10 +++++++---
 1 files changed, 7 insertions(+), 3 deletions(-)

diff --git a/storage/storage_log.py b/storage/storage_log.py
index 853b0cd..0d3d1bf 100644
--- a/storage/storage_log.py
+++ b/storage/storage_log.py
@@ -4,9 +4,13 @@ import inspect
 
 def log_method_call(d, *args, **kwargs):
     classname = d.__class__.__name__
-    methodname = inspect.stack()[1][3]
-    fmt = "%s.%s:"
-    fmt_args = [classname, methodname]
+    stack = inspect.stack()
+    methodname = stack[1][3]
+
+    spaces = len(stack) * ' '
+    fmt = "%s%s.%s:"
+    fmt_args = [spaces, classname, methodname]
+
     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