Skip to content

Commit

Permalink
update logging
Browse files Browse the repository at this point in the history
  • Loading branch information
JarbasAl committed Nov 24, 2023
1 parent a8ba0c0 commit a1221b0
Showing 1 changed file with 10 additions and 7 deletions.
17 changes: 10 additions & 7 deletions hivemind_core/service.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,14 @@
from os import makedirs
from os.path import exists, join
from socket import gethostname
from threading import Thread
from typing import Callable, Dict, Any, Optional, Tuple

from OpenSSL import crypto
from ovos_bus_client import MessageBusClient
from ovos_bus_client.session import Session
from ovos_config import Configuration
from ovos_utils.log import LOG
from ovos_utils.process_utils import ProcessStatus, StatusCallbackMap
from ovos_bus_client.session import Session
from ovos_utils.xdg_utils import xdg_data_home
from poorman_handshake import HandShake, PasswordHandShake
from pyee import EventEmitter
Expand All @@ -22,11 +22,11 @@
from tornado.websocket import WebSocketHandler

from hivemind_bus_client.identity import NodeIdentity
from hivemind_bus_client.message import HiveMessageType
from hivemind_core.database import ClientDatabase
from hivemind_core.protocol import HiveMindListenerProtocol, HiveMindClientConnection, HiveMindNodeType
from hivemind_presence import LocalPresence
from hivemind_ggwave import GGWaveMaster
from ovos_bus_client import MessageBusClient
from hivemind_presence import LocalPresence


def create_self_signed_cert(cert_dir=f"{xdg_data_home()}/hivemind",
Expand Down Expand Up @@ -105,7 +105,10 @@ def decode_auth(auth) -> Tuple[str, str]:

def on_message(self, message):
message = self.client.decode(message)
LOG.info(f"received {self.client.peer} message: {message}")
if message.msg_type == HiveMessageType.BUS and message.payload.msg_type == "recognizer_loop:b64_audio":
LOG.info(f"received {self.client.peer} sent base64 audio for STT")
else:
LOG.info(f"received {self.client.peer} message: {message}")
self.protocol.handle_message(message, self.client)

def open(self):
Expand Down Expand Up @@ -163,7 +166,7 @@ def check_origin(self, origin) -> bool:
class HiveMindService:
identity = NodeIdentity()

def __init__(self,
def __init__(self,
alive_hook: Callable = on_alive,
started_hook: Callable = on_started,
ready_hook: Callable = on_ready,
Expand All @@ -175,7 +178,7 @@ def __init__(self,
ws_handler=MessageBusEventHandler):

websocket_config = websocket_config or \
Configuration().get('hivemind_websocket', {})
Configuration().get('hivemind_websocket', {})
callbacks = StatusCallbackMap(on_started=started_hook,
on_alive=alive_hook,
on_ready=ready_hook,
Expand Down

0 comments on commit a1221b0

Please sign in to comment.