Skip to content

Commit

Permalink
Add configuration to suppress logging requests
Browse files Browse the repository at this point in the history
  • Loading branch information
cccs-rs committed Jan 8, 2025
1 parent 2bdd175 commit f7ed2bf
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions src/unoserver/server.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ def __init__(
self,
addr: tuple[str, int],
allow_none: bool = False,
log_requests: bool = True,
) -> None:
addr_info = socket.getaddrinfo(addr[0], addr[1], proto=socket.IPPROTO_TCP)

Expand All @@ -40,7 +41,7 @@ def __init__(

self.address_family = addr_info[0][0]
self.socket_type = addr_info[0][1]
super().__init__(addr=addr_info[0][4], allow_none=allow_none)
super().__init__(addr=addr_info[0][4], allow_none=allow_none, logRequests=log_requests)


class UnoServer:
Expand All @@ -52,6 +53,7 @@ def __init__(
uno_port="2002",
user_installation=None,
conversion_timeout=None,
log_requests=True,
):
self.interface = interface
self.uno_interface = uno_interface
Expand All @@ -63,6 +65,7 @@ def __init__(
self.xmlrcp_thread = None
self.xmlrcp_server = None
self.intentional_exit = False
self.log_requests = log_requests

def start(self, executable="libreoffice"):
logger.info(f"Starting unoserver {__version__}.")
Expand Down Expand Up @@ -127,7 +130,7 @@ def signal_handler(signum, frame):

def serve(self):
# Create server
with XMLRPCServer((self.interface, int(self.port)), allow_none=True) as server:
with XMLRPCServer((self.interface, int(self.port)), allow_none=True, log_requests=self.log_requests) as server:
self.conv = converter.UnoConverter(
interface=self.uno_interface, port=self.uno_port
)
Expand Down Expand Up @@ -337,6 +340,7 @@ def main():
args.uno_port,
user_installation,
args.conversion_timeout,
log_requests=not args.silent,
)

if args.executable is not None:
Expand Down

0 comments on commit f7ed2bf

Please sign in to comment.