From 662a06788ac274b330ce9903a68ab6616e8046b4 Mon Sep 17 00:00:00 2001 From: anchal00 Date: Fri, 6 Sep 2024 21:47:28 +0530 Subject: [PATCH] Change logging format --- optimus/dns/resolver.py | 9 ++++----- optimus/logging/logger.py | 2 +- 2 files changed, 5 insertions(+), 6 deletions(-) diff --git a/optimus/dns/resolver.py b/optimus/dns/resolver.py index 07d1835..b2ddc92 100644 --- a/optimus/dns/resolver.py +++ b/optimus/dns/resolver.py @@ -2,13 +2,11 @@ import random from typing import List, Union -from optimus.dns.models.packet import (DNSHeader, DNSPacket, Question, - ResponseCode) -from optimus.dns.models.records import (AAAA, NS, A, Record, RecordClass, - RecordType) +from optimus.dns.models.packet import DNSHeader, DNSPacket, Question, ResponseCode +from optimus.dns.models.records import AAAA, NS, A, Record, RecordClass, RecordType from optimus.dns.parser.parse import DNSParser from optimus.networking.udp import query_server_over_udp -from optimus.optimus_server.context import get_root_servers +from optimus.server.context import get_root_servers # TODO: Improve logging @@ -17,6 +15,7 @@ def resolve(qpacket: DNSPacket) -> DNSPacket: server_addr: str = random.choice(get_root_servers()) while True: _bytes: bytes = query_server_over_udp(qpacket.to_bin(), server_addr) + # TODO: Implement retries if not _bytes: return DNSPacket( DNSHeader( diff --git a/optimus/logging/logger.py b/optimus/logging/logger.py index 8a3a7d7..0fe3714 100644 --- a/optimus/logging/logger.py +++ b/optimus/logging/logger.py @@ -1,6 +1,6 @@ import logging -logging.basicConfig(level=logging.INFO, format="%(asctime)s %(levelname)s %(message)s") +logging.basicConfig(level=logging.INFO, format="ts=%(asctime)s level=%(levelname)s message=%(message)s") # TODO: Improve logging