55from flight_profiler .help_descriptions import STACK_COMMAND_DESCRIPTION
66from flight_profiler .plugins .cli_plugin import BaseCliPlugin
77from flight_profiler .plugins .stack .stack_parser import StackParams , global_stack_parser
8- from flight_profiler .utils .cli_util import show_error_info
8+ from flight_profiler .utils .cli_util import show_error_info , show_success_info
99from flight_profiler .utils .env_util import is_linux
10- from flight_profiler .utils .render_util import COLOR_END , COLOR_GREEN
1110
1211
1312class StackCliPlugin (BaseCliPlugin ):
@@ -52,8 +51,8 @@ def __analyze_under_linux(self, params: StackParams):
5251 for line in thread_lines :
5352 print (line , file = f , flush = True )
5453 stack_literal = "native stack" if params .native else "stack"
55- print (
56- f"{ COLOR_GREEN } write { stack_literal } to { params .filepath } successfully!{ COLOR_END } "
54+ show_success_info (
55+ f"Write { stack_literal } to { params .filepath } successfully!"
5756 )
5857
5958 def __show_coroutine_stacks (self , params : StackParams ):
@@ -80,8 +79,8 @@ def __show_coroutine_stacks(self, params: StackParams):
8079 with open (params .filepath , "w" ) as f :
8180 for line in coro_lines :
8281 print (line , file = f , flush = True )
83- print (
84- f"{ COLOR_GREEN } write coroutine stacks to { params .filepath } successfully!{ COLOR_END } "
82+ show_success_info (
83+ f"Write coroutine stacks to { params .filepath } successfully!"
8584 )
8685 finally :
8786 client .close ()
@@ -122,8 +121,8 @@ def do_action(self, cmd):
122121 if line :
123122 line = line .decode ("utf-8" )
124123 f .write (line + "\n " )
125- print (
126- f"{ COLOR_GREEN } write stack to { file_name } successfully!{ COLOR_END } "
124+ show_success_info (
125+ f"Write stack to { file_name } successfully!"
127126 )
128127 else :
129128 for line in client .request_stream (body ):
0 commit comments