Skip to content

Commit

Permalink
fix (api): remote logging config variable now updates the remote logg…
Browse files Browse the repository at this point in the history
…er settings when toggled
  • Loading branch information
AdamBelfki3 committed Feb 17, 2025
1 parent 9327c05 commit f48261b
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions src/nnsight/schema/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@
import yaml
from pydantic import BaseModel

from ..logger import remote_logger


class ApiConfigModel(BaseModel):
HOST: str = "ndif.dev"
Expand All @@ -22,6 +24,16 @@ class AppConfigModel(BaseModel):
FRAME_INJECTION: bool = True
GLOBAL_TRACING: bool = True

def __setattr__(self, name, value):
if name == "REMOTE_LOGGING":
self.on_remote_logging_change(value)
super().__setattr__(name, value)

def on_remote_logging_change(self, value: bool):
if value != self.REMOTE_LOGGING:
remote_logger.disabled = (not value)
self.__dict__["REMOTE_LOGGING"] = value


class ConfigModel(BaseModel):
API: ApiConfigModel = ApiConfigModel()
Expand Down

0 comments on commit f48261b

Please sign in to comment.