Skip to content

Commit 0d0025b

Browse files
authored
Adjust the log lines to the newer convention (#6)
1 parent 9785585 commit 0d0025b

File tree

1 file changed

+14
-14
lines changed

1 file changed

+14
-14
lines changed

hpdf/hpdf.py

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ def get(self, url, params=None, **kwargs) -> Response:
4242
last_error: Optional[Exception] = None
4343
for attempt in range(1, 3):
4444
print( # noqa: T201
45-
f"HTML2PDF_HTTPClient: sending GET request attempt {attempt}: {url}"
45+
f"html2pdf: sending GET request attempt {attempt}: {url}"
4646
)
4747
try:
4848
return requests.get(url, params, timeout=(5, 5), **kwargs)
@@ -52,10 +52,10 @@ def get(self, url, params=None, **kwargs) -> Response:
5252
last_error = read_timeout_
5353
except Exception as exception_:
5454
raise AssertionError(
55-
"HTML2PDF_HTTPClient: unknown exception", exception_
55+
"html2pdf: unknown exception", exception_
5656
) from None
5757
print( # noqa: T201
58-
f"HTML2PDF_HTTPClient: "
58+
f"html2pdf: "
5959
f"failed to get response for URL: {url} with error: {last_error}"
6060
)
6161

@@ -84,24 +84,24 @@ def find_driver(self, driver: Driver):
8484
)
8585
if os.path.isfile(path_to_cached_chrome_driver):
8686
print( # noqa: T201
87-
f"HTML2PDF_CacheManager: chromedriver exists in StrictDoc's local cache: "
87+
f"html2pdf: chromedriver exists in StrictDoc's local cache: "
8888
f"{path_to_cached_chrome_driver}"
8989
)
9090
return path_to_cached_chrome_driver
9191
print( # noqa: T201
92-
f"HTML2PDF_CacheManager: chromedriver does not exist in StrictDoc's local cache: "
92+
f"html2pdf: chromedriver does not exist in StrictDoc's local cache: "
9393
f"{path_to_cached_chrome_driver}"
9494
)
9595
path_to_downloaded_chrome_driver = super().find_driver(driver)
9696
if path_to_downloaded_chrome_driver is None:
9797
print( # noqa: T201
98-
f"HTML2PDF_CacheManager: could not get a downloaded Chrome driver: "
98+
f"html2pdf: could not get a downloaded Chrome driver: "
9999
f"{path_to_cached_chrome_driver}"
100100
)
101101
return None
102102

103103
print( # noqa: T201
104-
f"HTML2PDF_CacheManager: saving chromedriver to StrictDoc's local cache: "
104+
f"html2pdf: saving chromedriver to StrictDoc's local cache: "
105105
f"{path_to_downloaded_chrome_driver} -> {path_to_cached_chrome_driver}"
106106
)
107107
Path(path_to_cached_chrome_driver_dir).mkdir(
@@ -117,7 +117,7 @@ def get_inches_from_millimeters(mm: float) -> float:
117117

118118

119119
def get_pdf_from_html(driver, url) -> bytes:
120-
print(f"HTML2PDF: opening URL with Chrome Driver: {url}") # noqa: T201
120+
print(f"html2pdf: opening URL with ChromeDriver: {url}") # noqa: T201
121121

122122
driver.get(url)
123123

@@ -147,7 +147,7 @@ def get_pdf_from_html(driver, url) -> bytes:
147147
"marginRight": get_inches_from_millimeters(21),
148148
}
149149

150-
print("HTML2PDF: executing print command with Chrome Driver.") # noqa: T201
150+
print("html2pdf: executing print command with ChromeDriver.") # noqa: T201
151151
result = driver.execute_cdp_cmd("Page.printToPDF", calculated_print_options)
152152

153153
class Done(Exception): pass
@@ -171,7 +171,7 @@ class Done(Exception): pass
171171
print("error: could not receive a successful completion status from HTML2PDF.")
172172
sys.exit(1)
173173

174-
print("HTML2PDF: JS logs from the print session:") # noqa: T201
174+
print("html2pdf: JS logs from the print session:") # noqa: T201
175175
print('"""') # noqa: T201
176176
for entry in logs:
177177
print(entry) # noqa: T201
@@ -182,7 +182,7 @@ class Done(Exception): pass
182182

183183

184184
def create_webdriver(chromedriver: Optional[str], path_to_cache_dir: str):
185-
print("HTML2PDF: creating Chrome Driver service.", flush=True) # noqa: T201
185+
print("html2pdf: creating ChromeDriver service.", flush=True) # noqa: T201
186186
if chromedriver is None:
187187
cache_manager = HTML2PDF_CacheManager(
188188
file_manager=FileManager(
@@ -198,7 +198,7 @@ def create_webdriver(chromedriver: Optional[str], path_to_cache_dir: str):
198198
).install()
199199
else:
200200
path_to_chrome = chromedriver
201-
print(f"HTML2PDF: Chrome Driver available at path: {path_to_chrome}") # noqa: T201
201+
print(f"html2pdf: ChromeDriver available at path: {path_to_chrome}") # noqa: T201
202202

203203
service = Service(path_to_chrome)
204204

@@ -216,7 +216,7 @@ def create_webdriver(chromedriver: Optional[str], path_to_cache_dir: str):
216216
# Enable the capturing of everything in JS console.
217217
webdriver_options.set_capability("goog:loggingPrefs", {"browser": "ALL"})
218218

219-
print("HTML2PDF: creating Chrome Driver.", flush=True) # noqa: T201
219+
print("html2pdf: creating ChromeDriver.", flush=True) # noqa: T201
220220

221221
driver = webdriver.Chrome(
222222
options=webdriver_options,
@@ -261,7 +261,7 @@ def main():
261261

262262
@atexit.register
263263
def exit_handler():
264-
print("HTML2PDF: exit handler: quitting the Chrome Driver.") # noqa: T201
264+
print("html2pdf: exit handler: quitting the ChromeDriver.") # noqa: T201
265265
driver.quit()
266266

267267
for separate_path_pair_ in paths:

0 commit comments

Comments
 (0)