logdash 0.2.2__tar.gz → 1.0.2__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.
- {logdash-0.2.2/logdash.egg-info → logdash-1.0.2}/PKG-INFO +1 -1
- {logdash-0.2.2 → logdash-1.0.2}/logdash/__init__.py +1 -1
- {logdash-0.2.2 → logdash-1.0.2}/logdash/core.py +3 -2
- {logdash-0.2.2 → logdash-1.0.2/logdash.egg-info}/PKG-INFO +1 -1
- {logdash-0.2.2 → logdash-1.0.2}/logdash.egg-info/SOURCES.txt +0 -1
- {logdash-0.2.2 → logdash-1.0.2}/setup.py +10 -1
- logdash-0.2.2/examples/basic_usage.py +0 -49
- {logdash-0.2.2 → logdash-1.0.2}/LICENSE +0 -0
- {logdash-0.2.2 → logdash-1.0.2}/MANIFEST.in +0 -0
- {logdash-0.2.2 → logdash-1.0.2}/README.md +0 -0
- {logdash-0.2.2 → logdash-1.0.2}/logdash/constants.py +0 -0
- {logdash-0.2.2 → logdash-1.0.2}/logdash/internal.py +0 -0
- {logdash-0.2.2 → logdash-1.0.2}/logdash/logger.py +0 -0
- {logdash-0.2.2 → logdash-1.0.2}/logdash/metrics/__init__.py +0 -0
- {logdash-0.2.2 → logdash-1.0.2}/logdash/metrics/base.py +0 -0
- {logdash-0.2.2 → logdash-1.0.2}/logdash/metrics/factory.py +0 -0
- {logdash-0.2.2 → logdash-1.0.2}/logdash/metrics/impl.py +0 -0
- {logdash-0.2.2 → logdash-1.0.2}/logdash/metrics/noop.py +0 -0
- {logdash-0.2.2 → logdash-1.0.2}/logdash/sync/__init__.py +0 -0
- {logdash-0.2.2 → logdash-1.0.2}/logdash/sync/base.py +0 -0
- {logdash-0.2.2 → logdash-1.0.2}/logdash/sync/factory.py +0 -0
- {logdash-0.2.2 → logdash-1.0.2}/logdash/sync/http.py +0 -0
- {logdash-0.2.2 → logdash-1.0.2}/logdash/sync/noop.py +0 -0
- {logdash-0.2.2 → logdash-1.0.2}/logdash.egg-info/dependency_links.txt +0 -0
- {logdash-0.2.2 → logdash-1.0.2}/logdash.egg-info/requires.txt +0 -0
- {logdash-0.2.2 → logdash-1.0.2}/logdash.egg-info/top_level.txt +0 -0
- {logdash-0.2.2 → logdash-1.0.2}/setup.cfg +0 -0
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
from datetime import datetime
|
|
1
|
+
from datetime import datetime, timezone
|
|
2
2
|
from typing import Dict, Optional, Any
|
|
3
3
|
|
|
4
4
|
from logdash.logger import Logger
|
|
@@ -21,7 +21,8 @@ class logdash:
|
|
|
21
21
|
|
|
22
22
|
# Initialize logger
|
|
23
23
|
def on_log(level: LogLevel, message: str) -> None:
|
|
24
|
-
self._log_sync.send(message, level, datetime.now().isoformat())
|
|
24
|
+
self._log_sync.send(message, level, datetime.now(timezone.utc).isoformat().replace('+00:00', 'Z')
|
|
25
|
+
)
|
|
25
26
|
|
|
26
27
|
self._logger_instance = Logger(log_method=print, on_log=on_log)
|
|
27
28
|
|
|
@@ -3,10 +3,19 @@ Setup script for the logdash package.
|
|
|
3
3
|
"""
|
|
4
4
|
|
|
5
5
|
from setuptools import setup, find_packages
|
|
6
|
+
import re
|
|
7
|
+
|
|
8
|
+
# Read version from __init__.py
|
|
9
|
+
with open('logdash/__init__.py', 'r') as f:
|
|
10
|
+
version_match = re.search(r'^__version__\s*=\s*[\'"]([^\'"]*)[\'"]', f.read(), re.MULTILINE)
|
|
11
|
+
if version_match:
|
|
12
|
+
version = version_match.group(1)
|
|
13
|
+
else:
|
|
14
|
+
raise RuntimeError('Cannot find version information')
|
|
6
15
|
|
|
7
16
|
setup(
|
|
8
17
|
name="logdash",
|
|
9
|
-
version=
|
|
18
|
+
version=version,
|
|
10
19
|
packages=find_packages(),
|
|
11
20
|
install_requires=[
|
|
12
21
|
"requests>=2.25.0",
|
|
@@ -1,49 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env python3
|
|
2
|
-
"""
|
|
3
|
-
Basic usage example for the logdash SDK.
|
|
4
|
-
"""
|
|
5
|
-
|
|
6
|
-
import time
|
|
7
|
-
from logdash import create_logdash
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
def main():
|
|
11
|
-
"""Main function demonstrating logdash usage."""
|
|
12
|
-
# Initialize logdash with your API key
|
|
13
|
-
# For testing without an API key, logs will only be printed locally
|
|
14
|
-
logdash = create_logdash({
|
|
15
|
-
"api_key": "your-api-key", # Replace with your actual API key
|
|
16
|
-
"host": "https://api.logdash.io",
|
|
17
|
-
"verbose": True, # Enable verbose mode for development
|
|
18
|
-
})
|
|
19
|
-
|
|
20
|
-
# Get the logger instance
|
|
21
|
-
logger = logdash.logger
|
|
22
|
-
|
|
23
|
-
# Get the metrics instance
|
|
24
|
-
metrics = logdash.metrics
|
|
25
|
-
|
|
26
|
-
# Log messages at different levels
|
|
27
|
-
logger.info("Application started")
|
|
28
|
-
logger.debug("Debug information")
|
|
29
|
-
logger.warn("Warning message")
|
|
30
|
-
logger.error("Error occurred")
|
|
31
|
-
logger.http("HTTP request processed")
|
|
32
|
-
logger.verbose("Verbose details")
|
|
33
|
-
|
|
34
|
-
# Track metrics
|
|
35
|
-
for i in range(5):
|
|
36
|
-
# Set absolute values
|
|
37
|
-
metrics.set("active_users", 100 + i * 10)
|
|
38
|
-
|
|
39
|
-
# Mutate values (increment/decrement)
|
|
40
|
-
metrics.mutate("requests_count", 1)
|
|
41
|
-
|
|
42
|
-
logger.info(f"Iteration {i+1}/5 completed")
|
|
43
|
-
time.sleep(1)
|
|
44
|
-
|
|
45
|
-
logger.info("Example completed")
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
if __name__ == "__main__":
|
|
49
|
-
main()
|
|
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
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|