pycommonlog 0.2.2__tar.gz → 0.2.4__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: pycommonlog
3
- Version: 0.2.2
3
+ Version: 0.2.4
4
4
  Summary: Unified logging and alerting library for Python.
5
5
  Home-page: https://github.com/alvianhanif/pycommonlog
6
6
  Author: Alvian Rahman Hanif
@@ -2,7 +2,7 @@
2
2
  commonlog: Unified logging and alerting for Slack/Lark (Python)
3
3
  """
4
4
 
5
- from .log_types import SendMethod, AlertLevel, Attachment, Config, Provider, ChannelResolver, DefaultChannelResolver
5
+ from .log_types import SendMethod, AlertLevel, Attachment, Config, Provider, ChannelResolver, DefaultChannelResolver, LarkToken
6
6
  from .providers import SlackProvider, LarkProvider
7
7
  from .logger import commonlog
8
8
 
@@ -14,6 +14,7 @@ __all__ = [
14
14
  "Provider",
15
15
  "ChannelResolver",
16
16
  "DefaultChannelResolver",
17
+ "LarkToken",
17
18
  "SlackProvider",
18
19
  "LarkProvider",
19
20
  "commonlog"
@@ -2,16 +2,9 @@
2
2
  Main logger for commonlog
3
3
  """
4
4
  import logging
5
- import sys
6
- import os
7
5
 
8
- # Add current directory to path for direct imports
9
- _current_dir = os.path.dirname(os.path.abspath(__file__))
10
- if _current_dir not in sys.path:
11
- sys.path.insert(0, _current_dir)
12
-
13
- from providers import SlackProvider, LarkProvider
14
- from log_types import AlertLevel, Attachment, debug_log
6
+ from pycommonlog.providers import SlackProvider, LarkProvider
7
+ from pycommonlog.log_types import AlertLevel, Attachment, debug_log
15
8
 
16
9
  # ====================
17
10
  # Configuration and Logger
@@ -3,23 +3,13 @@ Lark Provider for commonlog
3
3
  """
4
4
  import requests
5
5
  import json
6
- import sys
7
- import os
8
6
  import time
9
7
  import threading
10
8
  from typing import Dict, Optional, Tuple
11
9
 
12
- # Add directories to path for imports
13
- _current_dir = os.path.dirname(os.path.abspath(__file__))
14
- _parent_dir = os.path.dirname(_current_dir)
15
- if _parent_dir not in sys.path:
16
- sys.path.insert(0, _parent_dir)
17
- if _current_dir not in sys.path:
18
- sys.path.insert(0, _current_dir)
19
-
20
- from log_types import SendMethod, Provider, debug_log
21
- from redis_client import get_redis_client, RedisConfigError
22
- from cache import get_memory_cache
10
+ from pycommonlog.log_types import SendMethod, Provider, debug_log
11
+ from pycommonlog.providers.redis_client import get_redis_client, RedisConfigError
12
+ from pycommonlog.cache import get_memory_cache
23
13
 
24
14
  class LarkProvider(Provider):
25
15
  def send_to_channel(self, level, message, attachment, config, channel):
@@ -215,7 +205,7 @@ class LarkProvider(Provider):
215
205
  payload = {
216
206
  "receive_id": chat_id,
217
207
  "msg_type": "post",
218
- "content": {
208
+ "content": json.dumps({
219
209
  "post": {
220
210
  "zh_cn": {
221
211
  "title": title,
@@ -229,7 +219,7 @@ class LarkProvider(Provider):
229
219
  ]
230
220
  }
231
221
  }
232
- }
222
+ })
233
223
  }
234
224
  debug_log(config, f"send_lark_webclient: sending HTTP request, payload size: {len(str(payload))}, payload: {json.dumps(payload)}")
235
225
 
@@ -2,15 +2,8 @@
2
2
  Slack Provider for commonlog
3
3
  """
4
4
  import requests
5
- import sys
6
- import os
7
5
 
8
- # Add parent directory to path for imports
9
- _parent_dir = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
10
- if _parent_dir not in sys.path:
11
- sys.path.insert(0, _parent_dir)
12
-
13
- from log_types import SendMethod, Provider, debug_log
6
+ from pycommonlog.log_types import SendMethod, Provider, debug_log
14
7
 
15
8
  class SlackProvider(Provider):
16
9
  def send_to_channel(self, level, message, attachment, config, channel):
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: pycommonlog
3
- Version: 0.2.2
3
+ Version: 0.2.4
4
4
  Summary: Unified logging and alerting library for Python.
5
5
  Home-page: https://github.com/alvianhanif/pycommonlog
6
6
  Author: Alvian Rahman Hanif
@@ -25,7 +25,7 @@ setup(
25
25
  name="pycommonlog",
26
26
  version=get_latest_git_tag(),
27
27
  description="Unified logging and alerting library for Python.",
28
- long_description=open("README.md").read(),
28
+ long_description=open("README.md", encoding="utf-8").read(),
29
29
  long_description_content_type="text/markdown",
30
30
  author="Alvian Rahman Hanif",
31
31
  author_email="alvian.hanif@pasarpolis.com",
File without changes
File without changes
File without changes