Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions yaqd-core/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
6 changes: 4 additions & 2 deletions yaqd-core/yaqd_core/_is_daemon.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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:
Expand All @@ -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)
Expand Down Expand Up @@ -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

Expand Down
4 changes: 2 additions & 2 deletions yaqd-core/yaqd_core/_protocol.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
2 changes: 1 addition & 1 deletion yaqd-core/yaqd_core/logging/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -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="{",
)

Expand Down