prettysimplelogging 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.
- prettysimplelogging-0.1.0/LICENSE +19 -0
- prettysimplelogging-0.1.0/PKG-INFO +10 -0
- prettysimplelogging-0.1.0/README.md +15 -0
- prettysimplelogging-0.1.0/pyproject.toml +16 -0
- prettysimplelogging-0.1.0/setup.cfg +4 -0
- prettysimplelogging-0.1.0/src/betterlogging/__init__.py +3 -0
- prettysimplelogging-0.1.0/src/betterlogging/blogging.py +54 -0
- prettysimplelogging-0.1.0/src/prettysimplelogging.egg-info/PKG-INFO +10 -0
- prettysimplelogging-0.1.0/src/prettysimplelogging.egg-info/SOURCES.txt +10 -0
- prettysimplelogging-0.1.0/src/prettysimplelogging.egg-info/dependency_links.txt +1 -0
- prettysimplelogging-0.1.0/src/prettysimplelogging.egg-info/requires.txt +1 -0
- prettysimplelogging-0.1.0/src/prettysimplelogging.egg-info/top_level.txt +1 -0
@@ -0,0 +1,19 @@
|
|
1
|
+
Copyright (c) 2025 Regan Willis
|
2
|
+
|
3
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
4
|
+
of this software and associated documentation files (the "Software"), to deal
|
5
|
+
in the Software without restriction, including without limitation the rights
|
6
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
7
|
+
copies of the Software, and to permit persons to whom the Software is
|
8
|
+
furnished to do so, subject to the following conditions:
|
9
|
+
|
10
|
+
The above copyright notice and this permission notice shall be included in all
|
11
|
+
copies or substantial portions of the Software.
|
12
|
+
|
13
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
14
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
15
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
16
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
17
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
18
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
19
|
+
SOFTWARE.
|
@@ -0,0 +1,10 @@
|
|
1
|
+
Metadata-Version: 2.4
|
2
|
+
Name: prettysimplelogging
|
3
|
+
Version: 0.1.0
|
4
|
+
Summary: Better Logging
|
5
|
+
Author-email: Regan Willis <reganwillis@outlook.com>
|
6
|
+
License-Expression: MIT
|
7
|
+
Project-URL: Homepage, https://github.com/reganwillis/BetterLogging
|
8
|
+
License-File: LICENSE
|
9
|
+
Requires-Dist: rich
|
10
|
+
Dynamic: license-file
|
@@ -0,0 +1,15 @@
|
|
1
|
+
# Better Logging for Python
|
2
|
+
|
3
|
+
Simple Python logging. Easy to use and pretty.
|
4
|
+
It's just CLI messages for now.
|
5
|
+
|
6
|
+
## Install
|
7
|
+
```
|
8
|
+
pip3 install .
|
9
|
+
```
|
10
|
+
|
11
|
+
## Usage
|
12
|
+
```
|
13
|
+
from betterlogging import Message as msg
|
14
|
+
msg('hello world').print()
|
15
|
+
```
|
@@ -0,0 +1,16 @@
|
|
1
|
+
[project]
|
2
|
+
name = "prettysimplelogging"
|
3
|
+
version = "0.1.0"
|
4
|
+
authors = [{name="Regan Willis", email="reganwillis@outlook.com"}]
|
5
|
+
description = "Better Logging"
|
6
|
+
dependencies = [
|
7
|
+
"rich"
|
8
|
+
]
|
9
|
+
license = "MIT"
|
10
|
+
|
11
|
+
[project.urls]
|
12
|
+
Homepage = "https://github.com/reganwillis/BetterLogging"
|
13
|
+
|
14
|
+
[build-system]
|
15
|
+
requires = ["setuptools>=61.0"]
|
16
|
+
build-backend = "setuptools.build_meta"
|
@@ -0,0 +1,54 @@
|
|
1
|
+
from rich import print
|
2
|
+
|
3
|
+
class Message:
|
4
|
+
"""
|
5
|
+
Message class to create CLI logs of different types.
|
6
|
+
"""
|
7
|
+
def __init__(self, _text, _type='INFO'):
|
8
|
+
# TODO: custom type
|
9
|
+
self.TYPES = ['INFO', 'WARN', 'ERR']
|
10
|
+
self.type = _type
|
11
|
+
self.text = _text
|
12
|
+
|
13
|
+
def __rich__(self):
|
14
|
+
return str(self)
|
15
|
+
|
16
|
+
def __str__(self):
|
17
|
+
return f'[{self._color}][bold][{self.type}][/bold] {self.text}[/]'
|
18
|
+
|
19
|
+
@property
|
20
|
+
def type(self):
|
21
|
+
return self._type
|
22
|
+
|
23
|
+
@type.setter
|
24
|
+
def type(self, t):
|
25
|
+
if t not in self.TYPES:
|
26
|
+
raise ValueError("Message type must be", self.TYPES)
|
27
|
+
self._type = t
|
28
|
+
|
29
|
+
if self._type == 'INFO':
|
30
|
+
self._color = 'cyan'
|
31
|
+
elif self._type == 'WARN':
|
32
|
+
self._color = 'yellow'
|
33
|
+
elif self._type == 'ERR':
|
34
|
+
self._color = 'red'
|
35
|
+
|
36
|
+
@property
|
37
|
+
def text(self):
|
38
|
+
return self._text
|
39
|
+
|
40
|
+
@text.setter
|
41
|
+
def text(self, t):
|
42
|
+
self._text = t
|
43
|
+
|
44
|
+
def print(self):
|
45
|
+
print(self)
|
46
|
+
|
47
|
+
|
48
|
+
if __name__ == "__main__":
|
49
|
+
print('Testing BetterLogging Messages')
|
50
|
+
print(Message('this is an info message'))
|
51
|
+
print(Message('this is an error message', 'ERR'))
|
52
|
+
print(Message('this is an warning message', 'WARN'))
|
53
|
+
Message('testing print func').print()
|
54
|
+
|
@@ -0,0 +1,10 @@
|
|
1
|
+
Metadata-Version: 2.4
|
2
|
+
Name: prettysimplelogging
|
3
|
+
Version: 0.1.0
|
4
|
+
Summary: Better Logging
|
5
|
+
Author-email: Regan Willis <reganwillis@outlook.com>
|
6
|
+
License-Expression: MIT
|
7
|
+
Project-URL: Homepage, https://github.com/reganwillis/BetterLogging
|
8
|
+
License-File: LICENSE
|
9
|
+
Requires-Dist: rich
|
10
|
+
Dynamic: license-file
|
@@ -0,0 +1,10 @@
|
|
1
|
+
LICENSE
|
2
|
+
README.md
|
3
|
+
pyproject.toml
|
4
|
+
src/betterlogging/__init__.py
|
5
|
+
src/betterlogging/blogging.py
|
6
|
+
src/prettysimplelogging.egg-info/PKG-INFO
|
7
|
+
src/prettysimplelogging.egg-info/SOURCES.txt
|
8
|
+
src/prettysimplelogging.egg-info/dependency_links.txt
|
9
|
+
src/prettysimplelogging.egg-info/requires.txt
|
10
|
+
src/prettysimplelogging.egg-info/top_level.txt
|
@@ -0,0 +1 @@
|
|
1
|
+
|
@@ -0,0 +1 @@
|
|
1
|
+
rich
|
@@ -0,0 +1 @@
|
|
1
|
+
betterlogging
|