From 92383842ad1e4adcfde02ad2b1cedd75ca6ff1ff Mon Sep 17 00:00:00 2001 From: Tyler Gu Date: Fri, 6 Sep 2024 18:16:05 -0500 Subject: [PATCH 1/3] Logging Signed-off-by: Tyler Gu --- acto/schema/array.py | 6 ++++-- acto/schema/object.py | 4 ++-- acto/schema/string.py | 5 +++-- 3 files changed, 9 insertions(+), 6 deletions(-) diff --git a/acto/schema/array.py b/acto/schema/array.py index c2f74c7e2..f85d3a722 100644 --- a/acto/schema/array.py +++ b/acto/schema/array.py @@ -1,7 +1,8 @@ -import logging import random from typing import List, Tuple +from utils.thread_logger import get_thread_logger + from .base import BaseSchema, TreeNode @@ -102,7 +103,8 @@ def to_tree(self) -> TreeNode: return node def load_examples(self, example: list): - logging.debug(f"Loading example {example} into {self}") + logger = get_thread_logger(with_prefix=True) + logger.debug(f"Loading example {example} into {self}") self.examples.append(example) for item in example: self.item_schema.load_examples(item) diff --git a/acto/schema/object.py b/acto/schema/object.py index 05402b537..4323fab6a 100644 --- a/acto/schema/object.py +++ b/acto/schema/object.py @@ -1,4 +1,3 @@ -import logging import random from typing import List, Tuple @@ -130,7 +129,8 @@ def to_tree(self) -> TreeNode: return node def load_examples(self, example: dict): - logging.debug(f"Loading example {example} into {self}") + logger = get_thread_logger(with_prefix=True) + logger.debug(f"Loading example {example} into {self}") self.examples.append(example) for key, value in example.items(): if key in self.properties: diff --git a/acto/schema/string.py b/acto/schema/string.py index 3cc96cfa8..d3ace2cf3 100644 --- a/acto/schema/string.py +++ b/acto/schema/string.py @@ -1,8 +1,8 @@ -import logging import random from typing import List, Optional, Tuple import exrex +from utils.thread_logger import get_thread_logger from acto.common import random_string @@ -48,7 +48,8 @@ def to_tree(self) -> TreeNode: return TreeNode(self.path) def load_examples(self, example: str): - logging.debug(f"Loading example {example} into {self}") + logger = get_thread_logger(with_prefix=True) + logger.debug(f"Loading example {example} into {self}") self.examples.append(example) def set_default(self, instance): From 611bb36724cf04a1fe713920f773ab75808a3118 Mon Sep 17 00:00:00 2001 From: Tyler Gu Date: Fri, 6 Sep 2024 18:17:53 -0500 Subject: [PATCH 2/3] Logging Signed-off-by: Tyler Gu --- acto/schema/array.py | 2 +- acto/schema/string.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/acto/schema/array.py b/acto/schema/array.py index f85d3a722..045af19dc 100644 --- a/acto/schema/array.py +++ b/acto/schema/array.py @@ -1,7 +1,7 @@ import random from typing import List, Tuple -from utils.thread_logger import get_thread_logger +from acto.utils.thread_logger import get_thread_logger from .base import BaseSchema, TreeNode diff --git a/acto/schema/string.py b/acto/schema/string.py index d3ace2cf3..a28b6a67b 100644 --- a/acto/schema/string.py +++ b/acto/schema/string.py @@ -2,9 +2,9 @@ from typing import List, Optional, Tuple import exrex -from utils.thread_logger import get_thread_logger from acto.common import random_string +from acto.utils.thread_logger import get_thread_logger from .base import BaseSchema, TreeNode From 1c3764d0e5d0ffad65b0ab63b24a1e710270be0d Mon Sep 17 00:00:00 2001 From: Tyler Gu Date: Fri, 6 Sep 2024 18:20:56 -0500 Subject: [PATCH 3/3] Logging Signed-off-by: Tyler Gu --- acto/input/input.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/acto/input/input.py b/acto/input/input.py index c01253ee8..44c59bc96 100644 --- a/acto/input/input.py +++ b/acto/input/input.py @@ -164,6 +164,8 @@ def __init__( for doc in docs: example_docs.append(doc) for example_doc in example_docs: + logger = get_thread_logger(with_prefix=True) + logger.info("Loading example document %s", example_doc) self.root_schema.load_examples(example_doc) self.num_workers = num_workers