Skip to content

Commit 4803281

Browse files
authored
chore: logger should not be setting up a BasicConfig (#106)
* feat: simple logger * doc: changelog and version
1 parent 407f700 commit 4803281

File tree

7 files changed

+7
-42
lines changed

7 files changed

+7
-42
lines changed

Diff for: CHANGELOG.md

+2-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
1-
## 0.3.3-dev1
1+
## 0.3.3-dev2
22

3+
* Removes BasicConfig from logger configuration
34
* Adds the `partition_email` partitioning brick
45
* Adds the `replace_mime_encodings` cleaning bricks
56
* Small fix to HTML parsing related to processing list items with sub-tags

Diff for: test_unstructured/test_logger.py

-15
This file was deleted.

Diff for: unstructured/__version__.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
__version__ = "0.3.3-dev1" # pragma: no cover
1+
__version__ = "0.3.3-dev2" # pragma: no cover

Diff for: unstructured/documents/html.py

+1-3
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99

1010
from lxml import etree
1111

12-
from unstructured.logger import get_logger
12+
from unstructured.logger import logger
1313

1414
from unstructured.cleaners.core import clean_bullets, replace_unicode_quotes
1515
from unstructured.documents.base import Page
@@ -21,8 +21,6 @@
2121
is_possible_title,
2222
)
2323

24-
logger = get_logger()
25-
2624
TEXT_TAGS: Final[List[str]] = ["p", "a", "td", "span", "font"]
2725
LIST_ITEM_TAGS: Final[List[str]] = ["li", "dd"]
2826
HEADING_TAGS: Final[List[str]] = ["h1", "h2", "h3", "h4", "h5", "h6"]

Diff for: unstructured/documents/xml.py

+1-2
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,9 @@
22

33
import lxml.etree as etree
44

5-
from unstructured.logger import get_logger
5+
from unstructured.logger import logger
66
from unstructured.documents.base import Document, Page
77

8-
logger = get_logger()
98

109
VALID_PARSERS = Union[etree.HTMLParser, etree.XMLParser, None]
1110

Diff for: unstructured/logger.py

+1-18
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,3 @@
11
import logging
2-
import os
3-
import sys
42

5-
if sys.version_info < (3, 8):
6-
from typing_extensions import Final
7-
else:
8-
from typing import Final
9-
10-
DEFAULT_LOG_LEVEL: Final[str] = "WARNING"
11-
12-
logging.basicConfig(format="%(asctime)s [%(levelname)s]: %(message)s")
13-
14-
15-
def get_logger() -> logging.Logger:
16-
log_level = os.environ.get("LOG_LEVEL", DEFAULT_LOG_LEVEL).upper()
17-
log_level = DEFAULT_LOG_LEVEL if not log_level else log_level
18-
logger = logging.getLogger(__name__)
19-
logger.setLevel(level=log_level)
20-
return logger
3+
logger = logging.getLogger("unstructured")

Diff for: unstructured/partition/text_type.py

+1-2
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,8 @@
99
from unstructured.cleaners.core import remove_punctuation
1010
from unstructured.nlp.patterns import UNICODE_BULLETS_RE
1111
from unstructured.nlp.tokenize import pos_tag, sent_tokenize, word_tokenize
12-
from unstructured.logger import get_logger
12+
from unstructured.logger import logger
1313

14-
logger = get_logger()
1514

1615
POS_VERB_TAGS: Final[List[str]] = ["VB", "VBG", "VBD", "VBN", "VBP", "VBZ"]
1716

0 commit comments

Comments
 (0)