Skip to content

Commit 325a6b3

Browse files
user control of log file base names, in ros2 launch (#461)
Signed-off-by: Tanishq Chaudhary <[email protected]> Co-authored-by: Katherine Scott <[email protected]>
1 parent 6b503ad commit 325a6b3

File tree

2 files changed

+8
-1
lines changed

2 files changed

+8
-1
lines changed

ros2launch/ros2launch/api/api.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -159,10 +159,14 @@ def launch_a_launch_file(
159159
if args and args.launch_prefix_filter:
160160
launch_file_arguments.append(f'launch-prefix-filter:={args.launch_prefix_filter}')
161161

162+
log_file_name = 'launch'
163+
if args and args.log_file_name:
164+
log_file_name = args.log_file_name
162165
launch_service = launch.LaunchService(
163166
argv=launch_file_arguments,
164167
noninteractive=noninteractive,
165-
debug=debug)
168+
debug=debug,
169+
log_file_name=log_file_name)
166170

167171
parsed_launch_arguments = parse_launch_arguments(launch_file_arguments)
168172
# Include the user provided launch file using IncludeLaunchDescription so that the

ros2launch/ros2launch/command/launch.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -91,6 +91,9 @@ def add_arguments(self, parser, cli_name):
9191
help=("Show all launched subprocesses' output by overriding their output"
9292
' configuration using the OVERRIDE_LAUNCH_PROCESS_OUTPUT envvar.')
9393
)
94+
parser.add_argument(
95+
'-f', '--log-file-name', type=str, default='launch',
96+
help='Name of the log file (postfixed with .log automatically if not provided).')
9497
parser.add_argument(
9598
'--launch-prefix',
9699
help='Prefix command, which should go before all executables. '

0 commit comments

Comments
 (0)