diff options
Diffstat (limited to 'scripts/automation')
-rwxr-xr-x | scripts/automation/trex_control_plane/server/CCustomLogger.py | 14 |
1 files changed, 8 insertions, 6 deletions
diff --git a/scripts/automation/trex_control_plane/server/CCustomLogger.py b/scripts/automation/trex_control_plane/server/CCustomLogger.py index fd9a32ad..551b0239 100755 --- a/scripts/automation/trex_control_plane/server/CCustomLogger.py +++ b/scripts/automation/trex_control_plane/server/CCustomLogger.py @@ -10,7 +10,8 @@ def prepare_dir(log_path): def setup_custom_logger(name, log_path = None):
# first make sure path availabe
- prepare_dir(log_path)
+ if log_path:
+ prepare_dir(log_path)
logging.basicConfig(level = logging.INFO,
format = '%(asctime)s %(name)-10s %(module)-20s %(levelname)-8s %(message)s',
datefmt = '%m-%d %H:%M')
@@ -30,11 +31,12 @@ def setup_custom_logger(name, log_path = None): def setup_daemon_logger (name, log_path = None):
# first make sure path availabe
- prepare_dir(log_path)
- try:
- os.unlink(log_path)
- except:
- pass
+ if log_path:
+ prepare_dir(log_path)
+ try:
+ os.unlink(log_path)
+ except:
+ pass
logging.basicConfig(level = logging.INFO,
format = '%(asctime)s %(name)-10s %(module)-20s %(levelname)-8s %(message)s',
datefmt = '%m-%d %H:%M',
|