##// END OF EJS Templates
ui: add a 'stacklevel' argument to 'develwarn'...
Pierre-Yves David -
r27274:82910fdc default
parent child Browse files
Show More
@@ -1044,15 +1044,21 b' class ui(object):'
1044 '''
1044 '''
1045 return msg
1045 return msg
1046
1046
1047 def develwarn(self, msg):
1047 def develwarn(self, msg, stacklevel=1):
1048 """issue a developer warning message"""
1048 """issue a developer warning message
1049
1050 Use 'stacklevel' to report the offender some layers further up in the
1051 stack.
1052 """
1049 msg = 'devel-warn: ' + msg
1053 msg = 'devel-warn: ' + msg
1054 stacklevel += 1 # get in develwarn
1050 if self.tracebackflag:
1055 if self.tracebackflag:
1051 util.debugstacktrace(msg, 2, self.ferr, self.fout)
1056 util.debugstacktrace(msg, stacklevel, self.ferr, self.fout)
1052 else:
1057 else:
1053 curframe = inspect.currentframe()
1058 curframe = inspect.currentframe()
1054 calframe = inspect.getouterframes(curframe, 2)
1059 calframe = inspect.getouterframes(curframe, 2)
1055 self.write_err('%s at: %s:%s (%s)\n' % ((msg,) + calframe[2][1:4]))
1060 self.write_err('%s at: %s:%s (%s)\n'
1061 % ((msg,) + calframe[stacklevel][1:4]))
1056
1062
1057 class paths(dict):
1063 class paths(dict):
1058 """Represents a collection of paths and their configs.
1064 """Represents a collection of paths and their configs.
General Comments 0
You need to be logged in to leave comments. Login now