advdbg 0.2.4__tar.gz → 0.2.5__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: advdbg
3
- Version: 0.2.4
3
+ Version: 0.2.5
4
4
  Summary: Minimalist colorful debug logger
5
5
  Author-email: Darkey <weplayok3@gmail.com>, WinFun <placeholder@gmail.com>
6
6
  License: MIT
@@ -40,7 +40,7 @@ Available types:
40
40
  `SUCCESS`
41
41
 
42
42
  Returns:
43
- [title of your debug at DATE AND TIME] Text to debug!
43
+ Info - title of your debug (01.07.2026, 06:34:53) Text to debug!
44
44
 
45
45
  Configure existing category:
46
46
  dbgVar.cfg(title='REQUEST')
@@ -48,9 +48,16 @@ dbgVar.cfg(title='REQUEST')
48
48
  BEFORE: title of your debug
49
49
  AFTER: REQUEST
50
50
 
51
- ## Change Log: v0.2.4
51
+ ## Change Log: v0.2.5
52
52
 
53
- - Hotfix 0.2.3
53
+ - Hotfix 0.2.4
54
+ - Deleted "logging" parameter. Use "output" instead.
55
+ - Added new output types: "console" AND "file".
56
+ - Fixed colors
57
+
58
+ ## Requirements
59
+
60
+ - Python >3.6
54
61
 
55
62
  ## LICENSE
56
63
 
@@ -25,7 +25,7 @@ Available types:
25
25
  `SUCCESS`
26
26
 
27
27
  Returns:
28
- [title of your debug at DATE AND TIME] Text to debug!
28
+ Info - title of your debug (01.07.2026, 06:34:53) Text to debug!
29
29
 
30
30
  Configure existing category:
31
31
  dbgVar.cfg(title='REQUEST')
@@ -33,9 +33,16 @@ dbgVar.cfg(title='REQUEST')
33
33
  BEFORE: title of your debug
34
34
  AFTER: REQUEST
35
35
 
36
- ## Change Log: v0.2.4
36
+ ## Change Log: v0.2.5
37
37
 
38
- - Hotfix 0.2.3
38
+ - Hotfix 0.2.4
39
+ - Deleted "logging" parameter. Use "output" instead.
40
+ - Added new output types: "console" AND "file".
41
+ - Fixed colors
42
+
43
+ ## Requirements
44
+
45
+ - Python >3.6
39
46
 
40
47
  ## LICENSE
41
48
 
@@ -1,5 +1,6 @@
1
1
  import threading
2
2
  import time
3
+ from datetime import datetime
3
4
 
4
5
  class Breakpoint:
5
6
  def __init__(self, delay: int | float = 30):
@@ -17,13 +17,13 @@ class AdvDBG:
17
17
  _category_store: Dict[str, Dict[str, Any]] = {}
18
18
  _defined_categories: Dict[str, 'AdvDBG'] = {}
19
19
 
20
- def __init__(self, title='DEBUG', activated=False, notify=False, logging=True, legacy=False):
20
+ def __init__(self, title='Debug', activated=False, notify=False, output: Optional[list[str]] = ['console'], legacy=False) -> List[str]:
21
21
  if isinstance(title, str) and isinstance(activated, bool) and isinstance(notify, bool):
22
22
  self.title = title
23
23
  self.activated = False
24
24
  self._defed = False
25
25
  self.notify = notify
26
- self.logging = logging
26
+ self.output = output
27
27
  self.legacy = legacy
28
28
  else:
29
29
  raise ValueError('Some parameters do not match required types')
@@ -34,18 +34,18 @@ class AdvDBG:
34
34
  self._defined_categories[title] = self
35
35
 
36
36
  @classmethod
37
- def define(cls, title='DEBUG', activated=True, notify=False, logging=True, legacy=False):
37
+ def define(cls, title: str = 'Debug', activated: bool = True, notify: bool = False, output: Optional[list[str]] = ['console'], legacy: bool = False) -> List[str]:
38
38
  '''Defines your debug category.
39
39
  :param title: Title of your category
40
40
  :param activated: Toggle availability of category
41
41
  :param notify: Toggles notification if category is not activated
42
- :param logging: Toggles is it logging
42
+ :param output: Where logger will save lines?
43
43
  :param legacy: Use old style?'''
44
- inst = cls(title, activated, notify, logging, legacy)
44
+ inst = cls(title, activated, notify, output, legacy)
45
45
  inst.title = title
46
46
  inst.activated = True
47
47
  inst.notify = notify
48
- inst.logging = logging
48
+ inst.output = output
49
49
  inst.legacy = legacy
50
50
  inst._defed = True
51
51
 
@@ -53,7 +53,7 @@ class AdvDBG:
53
53
  'title': title,
54
54
  'activated': activated,
55
55
  'notify': notify,
56
- 'logging': logging,
56
+ 'output': output,
57
57
  'legacy': legacy,
58
58
  'created_at': datetime.now()
59
59
  }
@@ -81,7 +81,7 @@ class AdvDBG:
81
81
 
82
82
  def _write_to_log(self, text, log_type='INFO'):
83
83
  '''For-Module only method.'''
84
- if not self.logging:
84
+ if not 'file' in self.output:
85
85
  return
86
86
 
87
87
  try:
@@ -122,11 +122,11 @@ class AdvDBG:
122
122
  text = f"Cannot convert to string format: {e}"
123
123
 
124
124
  if self.activated:
125
- if self.legacy:
125
+ if self.legacy and 'console' in self.output:
126
126
  print(f'[\033[90mINFO \033[95m{self.title} at {datetime.now().strftime("%D, %H:%M:%S")}\033[0m] {text} \033[0m')
127
- elif not self.legacy:
127
+ elif not self.legacy and 'console' in self.output:
128
128
  print(f'{Colors.INFO} Info - {self.title} ({datetime.now().strftime("%D, %H:%M:%S")}) | {text}\033[0m')
129
- if self.logging:
129
+ if 'file' in self.output:
130
130
  self._write_to_log(text, 'INFO')
131
131
  elif self.notify:
132
132
  print(f'Notification from {self.title}: Tried to output when disactivated.\n\033[93mTip: \033[0mIf you are did not want to saw these notifications, turn off NOTIFY property with using notify=False\033[0m')
@@ -141,11 +141,11 @@ class AdvDBG:
141
141
  text = f"Cannot convert to string format: {e}"
142
142
 
143
143
  if self.activated:
144
- if self.legacy:
144
+ if self.legacy and 'console' in self.output:
145
145
  print(f'[\033[90mWARN \033[95m{self.title} at {datetime.now().strftime("%D, %H:%M:%S")}\033[0m] {text} \033[0m')
146
- elif not self.legacy:
146
+ elif not self.legacy and 'console' in self.output:
147
147
  print(f'{Colors.WARN} Warn - {self.title} ({datetime.now().strftime("%D, %H:%M:%S")}) | {text}\033[0m')
148
- if self.logging:
148
+ if 'file' in self.output:
149
149
  self._write_to_log(text, 'WARN')
150
150
  elif self.notify:
151
151
  print(f'Notification from {self.title}: Tried to output when disactivated.\n\033[93mTip: \033[0mIf you are did not want to saw these notifications, turn off NOTIFY property with using notify=False')
@@ -160,11 +160,11 @@ class AdvDBG:
160
160
  text = f"Cannot convert to string format: {e}"
161
161
 
162
162
  if self.activated:
163
- if self.legacy:
163
+ if self.legacy and 'console' in self.output:
164
164
  print(f'[\033[90mSUCCESS \033[95m{self.title} at {datetime.now().strftime("%D, %H:%M:%S")}\033[0m] {text} \033[0m')
165
- elif not self.legacy:
165
+ elif not self.legacy and 'console' in self.output:
166
166
  print(f'{Colors.SUCCESS} Success - {self.title} ({datetime.now().strftime("%D, %H:%M:%S")}) | {text}\033[0m')
167
- if self.logging:
167
+ if 'file' in self.output:
168
168
  self._write_to_log(text, 'SUCCESS')
169
169
  elif self.notify:
170
170
  print(f'Notification from {self.title}: Tried to output when disactivated.\n\033[93mTip: \033[0mIf you are did not want to saw these notifications, turn off NOTIFY property with using notify=False')
@@ -183,8 +183,8 @@ class AdvDBG:
183
183
  if self.legacy:
184
184
  print(f'[\033[33mERROR \033[95m{self.title} at {datetime.now().strftime("%D, %H:%M:%S")}\033[0m] {text} \033[0m')
185
185
  elif not self.legacy:
186
- print(f'{Colors.ERROR} Error - {self.title} ({datetime.now().strftime("%D, %H:%M:%S")}) | {text}')
187
- if self.logging:
186
+ print(f'{Colors.ERROR} Error - {self.title} ({datetime.now().strftime("%D, %H:%M:%S")}) | {text}\033[0m')
187
+ if 'file' in self.output:
188
188
  self._write_to_log(text, 'ERROR')
189
189
  elif self.notify:
190
190
  print(f'Notification from {self.title}: Tried to output when disactivated.\n\033[93mTip: \033[0mIf you are did not want to saw these notifications, turn off NOTIFY property with using notify=False')
@@ -192,22 +192,10 @@ class AdvDBG:
192
192
  return
193
193
 
194
194
  def notification(self, text):
195
- if not isinstance(text, str):
196
- try:
197
- text = str(text)
198
- except Exception as e:
199
- text = f"Cannot convert to string format: {e}"
200
-
201
- if self.activated:
202
- print(f'[\033[94mNOTIFICATION \033[0m{self.title} at {datetime.now().strftime("%D, %H:%M:%S")}\033[0m] \033[94m{text}\033[0m')
203
- if self.logging:
204
- self._write_to_log(text, 'NOTIFICATION')
205
- elif self.notify:
206
- print(f'Notification from {self.title}: Tried to output when disactivated.\n\033[93mTip: \033[0mIf you are did not want to saw these notifications, turn off NOTIFY property with using notify=False')
207
- else:
208
- return
195
+ """This type is deprecated."""
196
+ print('Type "Notification" is deprecated. Please, change it to another.')
209
197
 
210
- def cfg(self, activated=None, title='DEBUG', notify=True, logging=True):
198
+ def cfg(self, activated=None, title: str = 'Debug', notify: bool = True, output: Optional[List[str]] = ['output']):
211
199
  '''Configure existing category'''
212
200
  if activated is not None:
213
201
  self.activated = activated
@@ -215,13 +203,13 @@ class AdvDBG:
215
203
  self.notify = notify
216
204
  elif title is not None:
217
205
  self.title = title
218
- elif logging is not None:
219
- self.logging = logging
206
+ elif output is not None:
207
+ self.output = output
220
208
 
221
209
  if self.title in self._category_store:
222
210
  self._category_store[self.title]['activated'] = self.activated
223
211
  self._category_store[self.title]["title"] = self.title
224
- self._category_store[self.title]["logging"] = self.logging
212
+ self._category_store[self.title]["output"] = self.output
225
213
 
226
214
  return self
227
215
 
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: advdbg
3
- Version: 0.2.4
3
+ Version: 0.2.5
4
4
  Summary: Minimalist colorful debug logger
5
5
  Author-email: Darkey <weplayok3@gmail.com>, WinFun <placeholder@gmail.com>
6
6
  License: MIT
@@ -40,7 +40,7 @@ Available types:
40
40
  `SUCCESS`
41
41
 
42
42
  Returns:
43
- [title of your debug at DATE AND TIME] Text to debug!
43
+ Info - title of your debug (01.07.2026, 06:34:53) Text to debug!
44
44
 
45
45
  Configure existing category:
46
46
  dbgVar.cfg(title='REQUEST')
@@ -48,9 +48,16 @@ dbgVar.cfg(title='REQUEST')
48
48
  BEFORE: title of your debug
49
49
  AFTER: REQUEST
50
50
 
51
- ## Change Log: v0.2.4
51
+ ## Change Log: v0.2.5
52
52
 
53
- - Hotfix 0.2.3
53
+ - Hotfix 0.2.4
54
+ - Deleted "logging" parameter. Use "output" instead.
55
+ - Added new output types: "console" AND "file".
56
+ - Fixed colors
57
+
58
+ ## Requirements
59
+
60
+ - Python >3.6
54
61
 
55
62
  ## LICENSE
56
63
 
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
4
4
 
5
5
  [project]
6
6
  name = "advdbg"
7
- version = "0.2.4"
7
+ version = "0.2.5"
8
8
  authors = [
9
9
  {name = "Darkey", email = "weplayok3@gmail.com"}, {name = "WinFun", email = "placeholder@gmail.com"}
10
10
  ]
File without changes
File without changes
File without changes
File without changes