log-collector-async 1.1.0__py3-none-any.whl → 1.1.1__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- log_collector/async_client.py +30 -14
- {log_collector_async-1.1.0.dist-info → log_collector_async-1.1.1.dist-info}/METADATA +4 -4
- {log_collector_async-1.1.0.dist-info → log_collector_async-1.1.1.dist-info}/RECORD +5 -5
- {log_collector_async-1.1.0.dist-info → log_collector_async-1.1.1.dist-info}/WHEEL +0 -0
- {log_collector_async-1.1.0.dist-info → log_collector_async-1.1.1.dist-info}/top_level.txt +0 -0
log_collector/async_client.py
CHANGED
|
@@ -462,29 +462,46 @@ class AsyncLogClient:
|
|
|
462
462
|
print(f"[Log Client] Flushing {len(self.queue)} remaining logs...")
|
|
463
463
|
batch = [self.queue.popleft() for _ in range(len(self.queue))]
|
|
464
464
|
|
|
465
|
-
#
|
|
466
|
-
loop = asyncio.new_event_loop()
|
|
465
|
+
# 이벤트 루프 안전하게 처리
|
|
467
466
|
try:
|
|
468
|
-
loop.
|
|
469
|
-
|
|
470
|
-
|
|
467
|
+
loop = asyncio.get_running_loop()
|
|
468
|
+
# 이미 실행 중인 루프가 있으면 태스크 생성
|
|
469
|
+
asyncio.create_task(self._send_batch(batch))
|
|
470
|
+
except RuntimeError:
|
|
471
|
+
# 실행 중인 루프가 없으면 새로 생성
|
|
472
|
+
loop = asyncio.new_event_loop()
|
|
473
|
+
try:
|
|
474
|
+
loop.run_until_complete(self._send_batch(batch))
|
|
475
|
+
finally:
|
|
476
|
+
loop.close()
|
|
471
477
|
|
|
472
478
|
def flush(self) -> None:
|
|
473
479
|
"""수동 flush - 큐에 있는 모든 로그 즉시 전송"""
|
|
474
480
|
if len(self.queue) > 0:
|
|
475
481
|
batch = [self.queue.popleft() for _ in range(len(self.queue))]
|
|
476
|
-
loop = asyncio.new_event_loop()
|
|
477
482
|
try:
|
|
478
|
-
loop.
|
|
479
|
-
|
|
480
|
-
|
|
483
|
+
loop = asyncio.get_running_loop()
|
|
484
|
+
# 이미 실행 중인 루프가 있으면 태스크 생성
|
|
485
|
+
asyncio.create_task(self._send_batch(batch))
|
|
486
|
+
except RuntimeError:
|
|
487
|
+
# 실행 중인 루프가 없으면 새로 생성
|
|
488
|
+
loop = asyncio.new_event_loop()
|
|
489
|
+
try:
|
|
490
|
+
loop.run_until_complete(self._send_batch(batch))
|
|
491
|
+
finally:
|
|
492
|
+
loop.close()
|
|
481
493
|
|
|
482
|
-
def close(self) -> None:
|
|
483
|
-
"""클라이언트 종료"""
|
|
494
|
+
async def close(self) -> None:
|
|
495
|
+
"""클라이언트 종료 (async 메서드)"""
|
|
484
496
|
self._stop_event.set()
|
|
485
497
|
if self._worker_thread and self._worker_thread.is_alive():
|
|
486
498
|
self._worker_thread.join(timeout=5)
|
|
487
|
-
|
|
499
|
+
|
|
500
|
+
# 남은 로그 전송
|
|
501
|
+
if len(self.queue) > 0:
|
|
502
|
+
print(f"[Log Client] Flushing {len(self.queue)} remaining logs...")
|
|
503
|
+
batch = [self.queue.popleft() for _ in range(len(self.queue))]
|
|
504
|
+
await self._send_batch(batch)
|
|
488
505
|
|
|
489
506
|
# 글로벌 에러 핸들러 해제
|
|
490
507
|
if self.enable_global_error_handler:
|
|
@@ -501,11 +518,10 @@ class AsyncLogClient:
|
|
|
501
518
|
self._original_excepthook = sys.excepthook
|
|
502
519
|
|
|
503
520
|
def exception_handler(exc_type, exc_value, exc_traceback):
|
|
504
|
-
# 에러 로깅
|
|
521
|
+
# 에러 로깅 (error_type은 error_with_trace가 자동으로 설정)
|
|
505
522
|
self.error_with_trace(
|
|
506
523
|
"Uncaught exception",
|
|
507
524
|
exception=exc_value,
|
|
508
|
-
error_type=exc_type.__name__,
|
|
509
525
|
auto_caller=False
|
|
510
526
|
)
|
|
511
527
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: log-collector-async
|
|
3
|
-
Version: 1.1.
|
|
3
|
+
Version: 1.1.1
|
|
4
4
|
Summary: 비동기 로그 수집 클라이언트
|
|
5
5
|
Home-page: https://github.com/yourusername/log-analysis-system
|
|
6
6
|
Author: Log Analysis System Team
|
|
@@ -94,7 +94,7 @@ Asynchronous batch logging with zero blocking:
|
|
|
94
94
|
|
|
95
95
|
### Step 1: Install
|
|
96
96
|
```bash
|
|
97
|
-
pip install log-collector
|
|
97
|
+
pip install log-collector-async
|
|
98
98
|
```
|
|
99
99
|
|
|
100
100
|
### Step 2: Use in your app
|
|
@@ -202,12 +202,12 @@ See [QUICKSTART.md](../../QUICKSTART.md) for detailed setup.
|
|
|
202
202
|
## 📦 Installation
|
|
203
203
|
|
|
204
204
|
```bash
|
|
205
|
-
pip install log-collector
|
|
205
|
+
pip install log-collector-async
|
|
206
206
|
```
|
|
207
207
|
|
|
208
208
|
Development dependencies (for testing):
|
|
209
209
|
```bash
|
|
210
|
-
pip install log-collector[dev]
|
|
210
|
+
pip install log-collector-async[dev]
|
|
211
211
|
```
|
|
212
212
|
|
|
213
213
|
## 💡 Basic Usage
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
log_collector/__init__.py,sha256=mMKUApIhihjC2dUpFqDIETlsv6fyTHSW3Wi-xmr9y6Q,235
|
|
2
|
-
log_collector/async_client.py,sha256=
|
|
2
|
+
log_collector/async_client.py,sha256=_8P-bitNqcoITiYN2rErZgzhW4r1unGU3TDjd91AQHs,23950
|
|
3
3
|
tests/__init__.py,sha256=nIjtuR9Yjo1I5YSO71TTufw2_pFXvJn0rKNEorpYaJE,23
|
|
4
4
|
tests/test_async_client.py,sha256=j-dtf9ayL3kaVctYA9IOHsyFzj57a-xRS1i_Az8MfAg,10155
|
|
5
5
|
tests/test_integration.py,sha256=5dF5GHZBtiyDWZjQBDSFzZ_ZvfiESBb0sohGMx_F8iw,12318
|
|
6
6
|
tests/test_performance.py,sha256=zXMNz4QjDgXgU1i_5T-n_BeDb3NI6dafKva1-DfLUBA,4852
|
|
7
|
-
log_collector_async-1.1.
|
|
8
|
-
log_collector_async-1.1.
|
|
9
|
-
log_collector_async-1.1.
|
|
10
|
-
log_collector_async-1.1.
|
|
7
|
+
log_collector_async-1.1.1.dist-info/METADATA,sha256=Ihf-SSyTTwsZHLBA31gB9quW6YvAQ2YUib3OUWbomwA,22343
|
|
8
|
+
log_collector_async-1.1.1.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
|
|
9
|
+
log_collector_async-1.1.1.dist-info/top_level.txt,sha256=4fOfJ7egtA7Xk4uHLPZt1hEfWk7w2i3DdkXWskkcPag,20
|
|
10
|
+
log_collector_async-1.1.1.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|