log-collector-async 1.1.0__tar.gz → 1.1.1__tar.gz

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.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: log-collector-async
3
- Version: 1.1.0
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
@@ -50,7 +50,7 @@ Asynchronous batch logging with zero blocking:
50
50
 
51
51
  ### Step 1: Install
52
52
  ```bash
53
- pip install log-collector
53
+ pip install log-collector-async
54
54
  ```
55
55
 
56
56
  ### Step 2: Use in your app
@@ -158,12 +158,12 @@ See [QUICKSTART.md](../../QUICKSTART.md) for detailed setup.
158
158
  ## 📦 Installation
159
159
 
160
160
  ```bash
161
- pip install log-collector
161
+ pip install log-collector-async
162
162
  ```
163
163
 
164
164
  Development dependencies (for testing):
165
165
  ```bash
166
- pip install log-collector[dev]
166
+ pip install log-collector-async[dev]
167
167
  ```
168
168
 
169
169
  ## 💡 Basic Usage
@@ -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.run_until_complete(self._send_batch(batch))
469
- finally:
470
- loop.close()
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.run_until_complete(self._send_batch(batch))
479
- finally:
480
- loop.close()
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
- self._graceful_shutdown()
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.0
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
@@ -9,7 +9,7 @@ with open("README.md", "r", encoding="utf-8") as fh:
9
9
 
10
10
  setup(
11
11
  name="log-collector-async",
12
- version="1.1.0",
12
+ version="1.1.1",
13
13
  author="Log Analysis System Team",
14
14
  author_email="jack1087902@gmail.com",
15
15
  description="비동기 로그 수집 클라이언트",