logdash 0.2.0__tar.gz → 0.2.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.
Files changed (27) hide show
  1. {logdash-0.2.0/logdash.egg-info → logdash-0.2.1}/PKG-INFO +1 -1
  2. {logdash-0.2.0 → logdash-0.2.1}/logdash/constants.py +7 -9
  3. {logdash-0.2.0 → logdash-0.2.1}/logdash/logger.py +20 -7
  4. {logdash-0.2.0 → logdash-0.2.1/logdash.egg-info}/PKG-INFO +1 -1
  5. {logdash-0.2.0 → logdash-0.2.1}/setup.py +1 -1
  6. {logdash-0.2.0 → logdash-0.2.1}/LICENSE +0 -0
  7. {logdash-0.2.0 → logdash-0.2.1}/MANIFEST.in +0 -0
  8. {logdash-0.2.0 → logdash-0.2.1}/README.md +0 -0
  9. {logdash-0.2.0 → logdash-0.2.1}/examples/basic_usage.py +0 -0
  10. {logdash-0.2.0 → logdash-0.2.1}/logdash/__init__.py +0 -0
  11. {logdash-0.2.0 → logdash-0.2.1}/logdash/core.py +0 -0
  12. {logdash-0.2.0 → logdash-0.2.1}/logdash/internal.py +0 -0
  13. {logdash-0.2.0 → logdash-0.2.1}/logdash/metrics/__init__.py +0 -0
  14. {logdash-0.2.0 → logdash-0.2.1}/logdash/metrics/base.py +0 -0
  15. {logdash-0.2.0 → logdash-0.2.1}/logdash/metrics/factory.py +0 -0
  16. {logdash-0.2.0 → logdash-0.2.1}/logdash/metrics/impl.py +0 -0
  17. {logdash-0.2.0 → logdash-0.2.1}/logdash/metrics/noop.py +0 -0
  18. {logdash-0.2.0 → logdash-0.2.1}/logdash/sync/__init__.py +0 -0
  19. {logdash-0.2.0 → logdash-0.2.1}/logdash/sync/base.py +0 -0
  20. {logdash-0.2.0 → logdash-0.2.1}/logdash/sync/factory.py +0 -0
  21. {logdash-0.2.0 → logdash-0.2.1}/logdash/sync/http.py +0 -0
  22. {logdash-0.2.0 → logdash-0.2.1}/logdash/sync/noop.py +0 -0
  23. {logdash-0.2.0 → logdash-0.2.1}/logdash.egg-info/SOURCES.txt +0 -0
  24. {logdash-0.2.0 → logdash-0.2.1}/logdash.egg-info/dependency_links.txt +0 -0
  25. {logdash-0.2.0 → logdash-0.2.1}/logdash.egg-info/requires.txt +0 -0
  26. {logdash-0.2.0 → logdash-0.2.1}/logdash.egg-info/top_level.txt +0 -0
  27. {logdash-0.2.0 → logdash-0.2.1}/setup.cfg +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: logdash
3
- Version: 0.2.0
3
+ Version: 0.2.1
4
4
  Summary: Python SDK for logdash logging and metrics service
5
5
  Home-page: https://logdash.io
6
6
  Author: logdash
@@ -1,7 +1,6 @@
1
1
  """Constants used throughout the logdash SDK."""
2
2
 
3
3
  from enum import Enum
4
- from colorama import Fore
5
4
 
6
5
 
7
6
  class LogLevel(str, Enum):
@@ -21,13 +20,12 @@ class MetricOperation(str, Enum):
21
20
  CHANGE = "change"
22
21
 
23
22
 
24
- # Color mapping for log levels in terminal output
25
23
  LOG_LEVEL_COLORS = {
26
- LogLevel.ERROR: Fore.RED,
27
- LogLevel.WARN: Fore.YELLOW,
28
- LogLevel.INFO: Fore.BLUE,
29
- LogLevel.HTTP: Fore.CYAN,
30
- LogLevel.VERBOSE: Fore.GREEN,
31
- LogLevel.DEBUG: Fore.LIGHTGREEN_EX,
32
- LogLevel.SILLY: Fore.LIGHTBLACK_EX,
24
+ LogLevel.ERROR: (231, 0, 11), # Red
25
+ LogLevel.WARN: (254, 154, 0), # Orange
26
+ LogLevel.INFO: (21, 93, 252), # Blue
27
+ LogLevel.HTTP: (0, 166, 166), # Teal
28
+ LogLevel.VERBOSE: (0, 166, 0), # Green
29
+ LogLevel.DEBUG: (0, 166, 62), # Light Green
30
+ LogLevel.SILLY: (80, 80, 80), # Gray
33
31
  }
@@ -1,10 +1,9 @@
1
1
  """Logger implementation for logdash."""
2
2
 
3
3
  from datetime import datetime
4
- from typing import Any, Callable, Optional
5
-
6
- from colorama import Style, init
4
+ from typing import Any, Callable, Optional, Tuple
7
5
 
6
+ from colorama import init # For Windows compatibility
8
7
  from logdash.constants import LogLevel, LOG_LEVEL_COLORS
9
8
 
10
9
  # Initialize colorama for cross-platform terminal colors
@@ -68,6 +67,19 @@ class Logger:
68
67
  def silly(self, *data: Any) -> None:
69
68
  """Log a silly message (lowest priority)."""
70
69
  self._log(LogLevel.SILLY, " ".join(str(item) for item in data))
70
+
71
+ def _rgb_to_ansi(self, rgb: Tuple[int, int, int]) -> str:
72
+ """
73
+ Convert RGB values to ANSI color escape sequence.
74
+
75
+ Args:
76
+ rgb: Tuple of (r, g, b) values
77
+
78
+ Returns:
79
+ ANSI color code string
80
+ """
81
+ r, g, b = rgb
82
+ return f"\033[38;2;{r};{g};{b}m"
71
83
 
72
84
  def _log(self, level: LogLevel, message: str) -> None:
73
85
  """
@@ -77,14 +89,15 @@ class Logger:
77
89
  level: The log level
78
90
  message: The message to log
79
91
  """
80
- # Format with color
81
- color = LOG_LEVEL_COLORS[level]
92
+ # Get RGB values and convert to ANSI color
93
+ rgb_color = LOG_LEVEL_COLORS[level]
94
+ color_code = self._rgb_to_ansi(rgb_color)
82
95
  timestamp = datetime.now().isoformat()
83
96
 
84
97
  # Format the message with timestamp and level prefix
85
98
  formatted_message = (
86
- f"\033[90m[{timestamp}]\033[0m "
87
- f"{color}{self.prefix(level)}\033[0m"
99
+ f"\033[38;2;150;150;150m[{timestamp}]\033[0m "
100
+ f"{color_code}{self.prefix(level)}\033[0m"
88
101
  f"{message}"
89
102
  )
90
103
 
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: logdash
3
- Version: 0.2.0
3
+ Version: 0.2.1
4
4
  Summary: Python SDK for logdash logging and metrics service
5
5
  Home-page: https://logdash.io
6
6
  Author: logdash
@@ -6,7 +6,7 @@ from setuptools import setup, find_packages
6
6
 
7
7
  setup(
8
8
  name="logdash",
9
- version="0.2.0",
9
+ version="0.2.1",
10
10
  packages=find_packages(),
11
11
  install_requires=[
12
12
  "requests>=2.25.0",
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes