diff --git a/yaqd-core/CHANGELOG.md b/yaqd-core/CHANGELOG.md index 5f8d640..16a6d7f 100644 --- a/yaqd-core/CHANGELOG.md +++ b/yaqd-core/CHANGELOG.md @@ -5,6 +5,9 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/). ## [Unreleased] +### Changed +- logging reports process ID at daemon startup + ### Fixed - type hints for IsSensor attributes are appropriate for _n_-dimensional data diff --git a/yaqd-core/yaqd_core/_is_daemon.py b/yaqd-core/yaqd_core/_is_daemon.py index c2940fe..a478f3f 100755 --- a/yaqd-core/yaqd_core/_is_daemon.py +++ b/yaqd-core/yaqd_core/_is_daemon.py @@ -13,6 +13,7 @@ import time from typing import Dict, List, Optional, Any from abc import ABC +from os import getpid import platformdirs # type: ignore import tomli @@ -210,6 +211,8 @@ def main(cls): @classmethod async def _main(cls, config_filepath, config_file, args=None): """Parse command line arguments, start event loop tasks.""" + cls._pid = getpid() + logger.info(f"PID: {cls._pid}") loop = asyncio.get_running_loop() cls.__servers = [] for section in config_file: @@ -218,7 +221,7 @@ async def _main(cls, config_filepath, config_file, args=None): try: config = cls._parse_config(config_file, section, args) except ValueError as e: - logger.error(str(e)) + logger.info(str(e)) continue logger.debug(f"Starting {section} with {config}") await cls._start_daemon(section, config, config_filepath) @@ -277,7 +280,6 @@ def _parse_config(cls, config_file, section, args=None): pass if not config.get("enable", True): - logger.info(f"Section '{section}' is disabled") raise ValueError(f"Section '{section}' is disabled") return config diff --git a/yaqd-core/yaqd_core/_protocol.py b/yaqd-core/yaqd_core/_protocol.py index 6644a08..fa8df50 100644 --- a/yaqd-core/yaqd_core/_protocol.py +++ b/yaqd-core/yaqd_core/_protocol.py @@ -17,14 +17,14 @@ def __init__(self, daemon, *args, **kwargs): def connection_lost(self, exc): peername = self.transport.get_extra_info("peername") - self.logger.info(f"Connection lost from {peername} to {self._daemon.name}") + self.logger.info(f"Connection with {peername} lost") self.task.cancel() self._daemon._connection_lost(peername) def connection_made(self, transport): """Process an incomming connection.""" peername = transport.get_extra_info("peername") - self.logger.info(f"Connection made from {peername} to {self._daemon.name}") + self.logger.info(f"Connection with {peername} made") self.transport = transport self.unpacker = avrorpc.Unpacker(self._avro_protocol) self._daemon._connection_made(peername) diff --git a/yaqd-core/yaqd_core/logging/__init__.py b/yaqd-core/yaqd_core/logging/__init__.py index 5161e6f..67b7d24 100644 --- a/yaqd-core/yaqd_core/logging/__init__.py +++ b/yaqd-core/yaqd_core/logging/__init__.py @@ -48,7 +48,7 @@ formatter = logging.Formatter( "{levelname} : {asctime} : {name} : {message}", - datefmt="%Y-%m-%dT%H:%M:%S%z", + datefmt="%Y-%m-%dT%H:%M:%S", style="{", )