Skip to content

Commit fe45dbb

Browse files
committed
Tweak logging
1 parent 5868ebd commit fe45dbb

File tree

2 files changed

+8
-6
lines changed

2 files changed

+8
-6
lines changed

Diff for: src/gitingest/utils.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,6 @@ async def wrapper(*args, **kwargs) -> T:
1717
try:
1818
return await asyncio.wait_for(func(*args, **kwargs), timeout=seconds)
1919
except asyncio.TimeoutError:
20-
raise AsyncTimeoutError(f"Operation timed out after {seconds} seconds")
20+
raise AsyncTimeoutError(f"Clone timed out after {seconds} seconds")
2121
return wrapper
2222
return decorator

Diff for: src/process_query.py

+7-5
Original file line numberDiff line numberDiff line change
@@ -11,21 +11,21 @@
1111
def print_query(query, request, max_file_size, pattern_type, pattern):
1212
print(f"{Colors.WHITE}{query['url']:<20}{Colors.END}", end="")
1313
if int(max_file_size/1024) != 50:
14-
print(f" | {Colors.PURPLE}Size: {int(max_file_size/1024)}kb{Colors.END}", end="")
14+
print(f" | {Colors.YELLOW}Size: {int(max_file_size/1024)}kb{Colors.END}", end="")
1515
if pattern_type == "include" and pattern != "":
16-
print(f" | {Colors.BLUE}Include {pattern}{Colors.END}", end="")
16+
print(f" | {Colors.YELLOW}Include {pattern}{Colors.END}", end="")
1717
elif pattern_type == "exclude" and pattern != "":
1818
print(f" | {Colors.YELLOW}Exclude {pattern}{Colors.END}", end="")
1919

2020

2121
def print_error(query, request, e, max_file_size, pattern_type, pattern):
22-
print(f"{Colors.BROWN}WARNING{Colors.END}: {Colors.RED}<- {Colors.END}", end="")
22+
print(f"{Colors.BROWN}WARN{Colors.END}: {Colors.RED}<- {Colors.END}", end="")
2323
print_query(query, request, max_file_size, pattern_type, pattern)
2424
print(f" | {Colors.RED}{e}{Colors.END}")
2525

2626
def print_success(query, request, max_file_size, pattern_type, pattern, summary):
2727
estimated_tokens = summary[summary.index("Estimated tokens:") + len("Estimated ") :]
28-
print(f"{Colors.GREEN}INFO{Colors.END}: {Colors.GREEN}<- {Colors.END}", end="")
28+
print(f"{Colors.GREEN}INFO{Colors.END}: {Colors.GREEN}<- {Colors.END}", end="")
2929
print_query(query, request, max_file_size, pattern_type, pattern)
3030
print(f" | {Colors.PURPLE}{estimated_tokens}{Colors.END}")
3131

@@ -50,10 +50,12 @@ async def process_query(request: Request, input_text: str, slider_position: int,
5050

5151

5252
except Exception as e:
53+
#hack to print error message when query is not defined
5354
if 'query' in locals() and query is not None and isinstance(query, dict):
5455
print_error(query, request, e, max_file_size, pattern_type, pattern)
5556
else:
56-
print(f"{Colors.RED}Error: {e}{Colors.END}")
57+
print(f"{Colors.BROWN}WARN{Colors.END}: {Colors.RED}<- {Colors.END}", end="")
58+
print(f"{Colors.RED}{e}{Colors.END}")
5759
return templates.TemplateResponse(
5860
template,
5961
{

0 commit comments

Comments
 (0)