litewave-logger 0.3.0__py3-none-any.whl → 0.4.0__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.
@@ -1,5 +1,6 @@
1
1
  import logging
2
2
  import json
3
+ import os
3
4
  from contextvars import ContextVar
4
5
 
5
6
  # Context variable to hold the request ID
@@ -53,7 +54,8 @@ def setup_logging(excluded_endpoints=[]):
53
54
  _excluded_endpoints = excluded_endpoints
54
55
 
55
56
  logger = logging.getLogger()
56
- logger.setLevel(logging.INFO)
57
+ log_level = os.getenv("LOG_LEVEL", "INFO").upper()
58
+ logger.setLevel(getattr(logging, log_level, logging.INFO))
57
59
 
58
60
  # Prevent adding duplicate handlers
59
61
  if not logger.handlers:
@@ -67,6 +69,7 @@ def setup_logging(excluded_endpoints=[]):
67
69
  if not any(isinstance(f, RequestIdFilter) for f in h.filters):
68
70
  h.addFilter(RequestIdFilter())
69
71
 
72
+ logger.info(f"Setting log level to {logging.getLevelName(logger.level)}, with excluded endpoints: {excluded_endpoints}")
70
73
  return logger
71
74
 
72
75
  def get_excluded_endpoints():
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: litewave_logger
3
- Version: 0.3.0
3
+ Version: 0.4.0
4
4
  Summary: A lightweight logging library with context carry forward
5
5
  Author: Litewave
6
6
  Author-email: Sonu Sudhakaran <sonu@litewave.ai>
@@ -0,0 +1,8 @@
1
+ litewave_logger/__init__.py,sha256=zYrepQkWHlyKDwxIKEaMCMSnv7oiTeWx9jjdzZASL98,2818
2
+ litewave_logger/celery.py,sha256=KkeuXNTQm7P_TFj_POdt7WTHL-mcP_Jv60g06Fkw_M4,3358
3
+ litewave_logger/middleware.py,sha256=P3Mjv0RZ7Bh7cxmJ4pH537wsORSXP-Dgn1PE9EKUcgQ,2375
4
+ litewave_logger/requests.py,sha256=tagJVwWWSVnrYHYRJ24HXu7YNBs9WxIHql0E1fRkbGA,1236
5
+ litewave_logger-0.4.0.dist-info/METADATA,sha256=sst7qtaxV4ZJyegWwYwXLPDyb6dowOWVnXCGokTWr1g,4839
6
+ litewave_logger-0.4.0.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
7
+ litewave_logger-0.4.0.dist-info/top_level.txt,sha256=omvs1vFc7ccmip7_gMDjF_3F8omnR-Gdfm2UudrqWuo,16
8
+ litewave_logger-0.4.0.dist-info/RECORD,,
@@ -1,8 +0,0 @@
1
- litewave_logger/__init__.py,sha256=gow3U-Op3f4xNTQ3ppBUD8mEAA0d_3hVa_u88mKLigg,2599
2
- litewave_logger/celery.py,sha256=KkeuXNTQm7P_TFj_POdt7WTHL-mcP_Jv60g06Fkw_M4,3358
3
- litewave_logger/middleware.py,sha256=P3Mjv0RZ7Bh7cxmJ4pH537wsORSXP-Dgn1PE9EKUcgQ,2375
4
- litewave_logger/requests.py,sha256=tagJVwWWSVnrYHYRJ24HXu7YNBs9WxIHql0E1fRkbGA,1236
5
- litewave_logger-0.3.0.dist-info/METADATA,sha256=3aIHcutM1eocQhI50SVjKpB3U1rCglvbwbL9CW5v7OQ,4839
6
- litewave_logger-0.3.0.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
7
- litewave_logger-0.3.0.dist-info/top_level.txt,sha256=omvs1vFc7ccmip7_gMDjF_3F8omnR-Gdfm2UudrqWuo,16
8
- litewave_logger-0.3.0.dist-info/RECORD,,