Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 6 additions & 2 deletions grafana-configs/loki_logger.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
"""

import json
import sys
import time
from datetime import datetime
from threading import Thread
Expand Down Expand Up @@ -111,9 +112,12 @@ def _send_to_loki_sync(self, level: str, message: str) -> None:

def _log(self, level: str, message: str) -> None:
"""Queue log entry for async processing (non-blocking)"""
# Print to console immediately for real-time feedback
# Print to console immediately for real-time feedback. Written to
# stderr (not stdout) so callers that capture a subprocess's stdout
# for its return value (e.g. decrypt_vault_secrets.py) never pick up
# log lines mixed in with the actual output.
timestamp = datetime.now().strftime("%Y-%m-%d %H:%M:%S")
print(f"[{timestamp}] {level: <8} | {message}") # noqa: T201
print(f"[{timestamp}] {level: <8} | {message}", file=sys.stderr) # noqa: T201

# Queue for async Loki sending (non-blocking)
try:
Expand Down
8 changes: 6 additions & 2 deletions src/loki_logger.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
"""

import json
import sys
import time
from datetime import datetime
from threading import Thread
Expand Down Expand Up @@ -119,9 +120,12 @@ def _send_to_loki_sync(self, level: str, message: str) -> None:

def _log(self, level: str, message: str) -> None:
"""Queue log entry for async processing (non-blocking)"""
# Print to console immediately for real-time feedback
# Print to console immediately for real-time feedback. Written to
# stderr (not stdout) so callers that capture a subprocess's stdout
# for its return value (e.g. decrypt_vault_secrets.py) never pick up
# log lines mixed in with the actual output.
timestamp = datetime.now().strftime("%Y-%m-%d %H:%M:%S")
print(f"[{timestamp}] {level: <8} | {message}") # noqa: T201
print(f"[{timestamp}] {level: <8} | {message}", file=sys.stderr) # noqa: T201

# Queue for async Loki sending (non-blocking, drops log if queue is full)
try:
Expand Down
8 changes: 6 additions & 2 deletions src/vector_indexer/loki_logger.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
"""

import json
import sys
import time
from datetime import datetime
from threading import Thread
Expand Down Expand Up @@ -111,9 +112,12 @@ def _send_to_loki_sync(self, level: str, message: str) -> None:

def _log(self, level: str, message: str) -> None:
"""Queue log entry for async processing (non-blocking)"""
# Print to console immediately for real-time feedback
# Print to console immediately for real-time feedback. Written to
# stderr (not stdout) so callers that capture a subprocess's stdout
# for its return value (e.g. decrypt_vault_secrets.py) never pick up
# log lines mixed in with the actual output.
timestamp = datetime.now().strftime("%Y-%m-%d %H:%M:%S")
print(f"[{timestamp}] {level: <8} | {message}") # noqa: T201
print(f"[{timestamp}] {level: <8} | {message}", file=sys.stderr) # noqa: T201

# Queue for async Loki sending (non-blocking)
try:
Expand Down
Loading