File tree 2 files changed +20
-8
lines changed
2 files changed +20
-8
lines changed Original file line number Diff line number Diff line change @@ -68,15 +68,16 @@ def __init__(
68
68
"""
69
69
# Setup logging and debugging.
70
70
launch .logging .launch_config .level = logging .DEBUG if debug else logging .INFO
71
- if log_file_name is None :
72
- log_file_name = 'launch'
71
+ self ._log_file_name = log_file_name
72
+ if self ._log_file_name is None :
73
+ self ._log_file_name = 'launch'
73
74
# Ensure the log file name ends with `.log`
74
- if not log_file_name .endswith ('.log' ):
75
- log_file_name += '.log'
76
- launch .logging .launch_config .log_file_name = log_file_name
75
+ if not self . _log_file_name .endswith ('.log' ):
76
+ self . _log_file_name += '.log'
77
+ launch .logging .launch_config .log_file_name = self . _log_file_name
77
78
# Setup logging
78
- logger_name = log_file_name .removesuffix ('.log' )
79
- self .__logger = launch .logging .get_logger (logger_name )
79
+ self . _logger_name = self . _log_file_name .removesuffix ('.log' )
80
+ self .__logger = launch .logging .get_logger (self . _logger_name )
80
81
81
82
self .__debug = debug
82
83
self .__argv = argv if argv is not None else []
Original file line number Diff line number Diff line change 26
26
27
27
def test_launch_service_constructors ():
28
28
"""Test the constructors for LaunchService class."""
29
- LaunchService ()
29
+ # When no name is provided for log file
30
+ ls = LaunchService ()
31
+ assert ls ._log_file_name == 'launch.log'
32
+ assert ls ._logger_name == 'launch'
33
+ # WHen log file name is provided without .log
34
+ ls = LaunchService (log_file_name = 'custom_logger' )
35
+ assert ls ._log_file_name == 'custom_logger.log'
36
+ assert ls ._logger_name == 'custom_logger'
37
+ # When log file name is provided with .log
38
+ ls = LaunchService (log_file_name = 'custom_logger.log' )
39
+ assert ls ._log_file_name == 'custom_logger.log'
40
+ assert ls ._logger_name == 'custom_logger'
30
41
LaunchService (debug = True )
31
42
LaunchService (debug = False )
32
43
You can’t perform that action at this time.
0 commit comments