liplog 0.1.0__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.
liplog-0.1.0/PKG-INFO ADDED
@@ -0,0 +1,46 @@
1
+ Metadata-Version: 2.4
2
+ Name: liplog
3
+ Version: 0.1.0
4
+ Summary: Python helpers for create a log file in the script folder and display it in the terminal
5
+ Author: Robert Lippert
6
+ Project-URL: Homepage, https://github.com/R0g3rT/liplog
7
+ Project-URL: Repository, https://github.com/R0g3rT/liplog
8
+ Project-URL: Issues, https://github.com/R0g3rT/liplog/issues
9
+ Keywords: log,logging,terminal,file,liplog
10
+ Classifier: Programming Language :: Python :: 3
11
+ Classifier: Programming Language :: Python :: 3.10
12
+ Classifier: Programming Language :: Python :: 3.11
13
+ Classifier: Programming Language :: Python :: 3.12
14
+ Classifier: Operating System :: OS Independent
15
+ Requires-Python: >=3.10
16
+ Description-Content-Type: text/markdown
17
+
18
+ # Liplog
19
+
20
+ mit dieser Bibliothke können sie einfach eine Logdatei im selben Ordner erstellen ohne eine komplette Loglogic zuschreiben.
21
+
22
+ ## Instalation
23
+
24
+ Instalation über PIP:
25
+
26
+ ```bash
27
+ python pip install liplog
28
+ ```
29
+ Instalation direk von GitHub (Git muss Instaliert sein):
30
+
31
+ ```bash
32
+ python pip install git+https://github.com/R0g3rT/liplog.git
33
+ ```
34
+
35
+ Uninstall
36
+ ```bash
37
+ python pip uninstall liplog
38
+ ```
39
+
40
+ ## Verwendung
41
+
42
+ ```python
43
+ import liplpg
44
+
45
+ write_log("API client gestartet", "INFO")
46
+ ```
liplog-0.1.0/README.md ADDED
@@ -0,0 +1,29 @@
1
+ # Liplog
2
+
3
+ mit dieser Bibliothke können sie einfach eine Logdatei im selben Ordner erstellen ohne eine komplette Loglogic zuschreiben.
4
+
5
+ ## Instalation
6
+
7
+ Instalation über PIP:
8
+
9
+ ```bash
10
+ python pip install liplog
11
+ ```
12
+ Instalation direk von GitHub (Git muss Instaliert sein):
13
+
14
+ ```bash
15
+ python pip install git+https://github.com/R0g3rT/liplog.git
16
+ ```
17
+
18
+ Uninstall
19
+ ```bash
20
+ python pip uninstall liplog
21
+ ```
22
+
23
+ ## Verwendung
24
+
25
+ ```python
26
+ import liplpg
27
+
28
+ write_log("API client gestartet", "INFO")
29
+ ```
@@ -0,0 +1,45 @@
1
+ import sys
2
+ from datetime import datetime as d
3
+ from pathlib import Path as pa
4
+ import logging
5
+
6
+ def save_logfile(log_name=None):
7
+ script_path = pa(sys.argv[0]).resolve().parent
8
+ log_path = script_path / "logs"
9
+ log_path.mkdir(parents=True, exist_ok=True)
10
+ script_name = log_name or pa(sys.argv[0]).resolve().stem or f"log_"
11
+ safe_name = "".join(c if c.isalnum() or c in (' ', '.', '_') else '_' for c in script_name)
12
+ log_file = log_path / f"{safe_name}-{d.now().strftime('%Y-%m-%d_%H-%M-%S')}.log"
13
+
14
+ logging.basicConfig(
15
+ level="INFO",
16
+ format="[%(asctime)s] [%(levelname)s] %(message)s",
17
+ handlers=[
18
+ logging.FileHandler(log_file, encoding='ascii'),
19
+ logging.StreamHandler()
20
+ ],
21
+ )
22
+ return log_file
23
+
24
+ _log_file = save_logfile()
25
+
26
+ def write_log(message, level="info"):
27
+ timestamp = d.now().strftime('%Y-%m-%d %H:%M:%S')
28
+ log_entry = f"[{timestamp}] [{level.upper()}] {message}"
29
+ if _log_file is not None:
30
+ logging.log(getattr(logging, level.upper(), logging.INFO), log_entry)
31
+ else:
32
+ print(log_entry)
33
+
34
+ color = {
35
+ "INFO": "\033[94m",
36
+ "WARNING": "\033[93m",
37
+ "ERROR": "\033[91m",
38
+ "DEBUG": "\033[92m",
39
+ "CRITICAL": "\033[95m",
40
+ "ENDC": "\033[0m",
41
+ }
42
+ colored_log_entry = f"{color.get(level.upper(), '')}{log_entry}{color['ENDC']}"
43
+ if _log_file is None:
44
+ print(colored_log_entry)
45
+
@@ -0,0 +1,46 @@
1
+ Metadata-Version: 2.4
2
+ Name: liplog
3
+ Version: 0.1.0
4
+ Summary: Python helpers for create a log file in the script folder and display it in the terminal
5
+ Author: Robert Lippert
6
+ Project-URL: Homepage, https://github.com/R0g3rT/liplog
7
+ Project-URL: Repository, https://github.com/R0g3rT/liplog
8
+ Project-URL: Issues, https://github.com/R0g3rT/liplog/issues
9
+ Keywords: log,logging,terminal,file,liplog
10
+ Classifier: Programming Language :: Python :: 3
11
+ Classifier: Programming Language :: Python :: 3.10
12
+ Classifier: Programming Language :: Python :: 3.11
13
+ Classifier: Programming Language :: Python :: 3.12
14
+ Classifier: Operating System :: OS Independent
15
+ Requires-Python: >=3.10
16
+ Description-Content-Type: text/markdown
17
+
18
+ # Liplog
19
+
20
+ mit dieser Bibliothke können sie einfach eine Logdatei im selben Ordner erstellen ohne eine komplette Loglogic zuschreiben.
21
+
22
+ ## Instalation
23
+
24
+ Instalation über PIP:
25
+
26
+ ```bash
27
+ python pip install liplog
28
+ ```
29
+ Instalation direk von GitHub (Git muss Instaliert sein):
30
+
31
+ ```bash
32
+ python pip install git+https://github.com/R0g3rT/liplog.git
33
+ ```
34
+
35
+ Uninstall
36
+ ```bash
37
+ python pip uninstall liplog
38
+ ```
39
+
40
+ ## Verwendung
41
+
42
+ ```python
43
+ import liplpg
44
+
45
+ write_log("API client gestartet", "INFO")
46
+ ```
@@ -0,0 +1,7 @@
1
+ README.md
2
+ pyproject.toml
3
+ liplog/liplog.py
4
+ liplog.egg-info/PKG-INFO
5
+ liplog.egg-info/SOURCES.txt
6
+ liplog.egg-info/dependency_links.txt
7
+ liplog.egg-info/top_level.txt
@@ -0,0 +1 @@
1
+ liplog
@@ -0,0 +1,29 @@
1
+ [project]
2
+ name = "liplog"
3
+ version = "0.1.0"
4
+ description = "Python helpers for create a log file in the script folder and display it in the terminal"
5
+ readme = "README.md"
6
+ requires-python = ">=3.10"
7
+ authors = [
8
+ {name = "Robert Lippert"}
9
+ ]
10
+ keywords = ["log", "logging", "terminal", "file", "liplog"]
11
+ classifiers = [
12
+ "Programming Language :: Python :: 3",
13
+ "Programming Language :: Python :: 3.10",
14
+ "Programming Language :: Python :: 3.11",
15
+ "Programming Language :: Python :: 3.12",
16
+ "Operating System :: OS Independent",
17
+ ]
18
+ [project.urls]
19
+ Homepage = "https://github.com/R0g3rT/liplog"
20
+ Repository = "https://github.com/R0g3rT/liplog"
21
+ Issues = "https://github.com/R0g3rT/liplog/issues"
22
+
23
+ [tool.setuptools.packages.find]
24
+ where = ["."]
25
+ include = ["liplog*"]
26
+
27
+ [build-system]
28
+ requires = ["setuptools"]
29
+ build-backend = "setuptools.build_meta"
liplog-0.1.0/setup.cfg ADDED
@@ -0,0 +1,4 @@
1
+ [egg_info]
2
+ tag_build =
3
+ tag_date = 0
4
+