Skip to content

Commit

Permalink
Log lvmecp logger to actor file handler
Browse files Browse the repository at this point in the history
  • Loading branch information
albireox committed Dec 29, 2024
1 parent f261726 commit 02cd94b
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 11 deletions.
13 changes: 2 additions & 11 deletions python/lvmecp/actor/actor.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,18 +9,15 @@
from __future__ import annotations

import asyncio
import logging
import time

from lvmopstools.actor import ErrorCodesBase, LVMActor
from lvmopstools.notifications import send_notification

from clu.tools import ActorHandler
from sdsstools.utils import cancel_task

from lvmecp import __version__, log
from lvmecp.actor.commands import parser
from lvmecp.exceptions import ECPWarning
from lvmecp.maskbits import DomeStatus
from lvmecp.plc import PLC

Expand All @@ -45,14 +42,8 @@ def __init__(

super().__init__(*args, **kwargs)

self.actor_handler = ActorHandler(
self,
level=logging.WARNING,
filter_warnings=[ECPWarning],
)
log.addHandler(self.actor_handler)
if log.warnings_logger:
log.warnings_logger.addHandler(self.actor_handler)
if self.log.log_filename and self.log.fh:
log.addHandler(self.log.fh)

if plc is None:
plc_config = plc_config or self.config
Expand Down
5 changes: 5 additions & 0 deletions python/lvmecp/modbus.py
Original file line number Diff line number Diff line change
Expand Up @@ -247,6 +247,11 @@ def __init__(self, config: dict | pathlib.Path | str | None = None):
for name, register in registers.items():
setattr(self, name, register)

log.debug(
f"Modbus connection to {self.host}:{self.port} initialised "
f"with cache timeout {self.cache_timeout} seconds."
)

async def connect(self):
"""Connects to the client."""

Expand Down

0 comments on commit 02cd94b

Please sign in to comment.