ptp-notification-armada-app/locationservice-base/docker/locationservice/locationservicesdk/common/helpers/log_helper.py
Douglas Henrique Koerich 297584e7b9 Fix bad path for PTP configuration files
The PTP tracking container ("notificationservice-base") used hard-coded
path in the reference to ptp4l, phc2sys and ts2phc configuration files,
which led to bad initialization in a Debian environment (regardless the
container is CentOS-based, since the path is mapped to the host).
This change tests for the correct path, either in ./linuxptp/ptpinstance
(Debian) or ./ptpinstance (CentOS).
It also fixes an issue when there is no PHC interface defined, neither
in the command line or in the phc2sys configuration file.

BONUS: The logging helper of location service was fixed to properly log
the messages like done already for the other images (notification server
and client). Logging level can now be set also for this container.

Test Plan:
PASS: Built and tested new image for notificationservice-base.

Closes-Bug: #1994192
Signed-off-by: Douglas Henrique Koerich <douglashenrique.koerich@windriver.com>
Change-Id: I7be15b19b9a165a47e12c38deb9eed2b5b7d09ee
2022-10-28 11:10:45 -03:00

23 lines
546 B
Python

#
# Copyright (c) 2021-2022 Wind River Systems, Inc.
#
# SPDX-License-Identifier: Apache-2.0
#
import logging
import sys
import os
def get_logger(module_name):
logger = logging.getLogger(module_name)
return config_logger(logger)
def config_logger(logger):
logging.basicConfig(stream=sys.stdout,
format='%(asctime)s %(levelname)-8s %(message)s',
datefmt='%Y-%m-%d %H:%M:%S')
logger.setLevel(level=os.environ.get("LOGGING_LEVEL", "INFO"))
return logger