psiutils 0.1.69__py3-none-any.whl → 0.1.71__py3-none-any.whl

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.
psiutils/_about_frame.py CHANGED
@@ -8,7 +8,7 @@ import markdown
8
8
  from psiutils.constants import PAD, Pad
9
9
  from psiutils.utilities import window_resize
10
10
 
11
- import psiutils.text
11
+ from psiutils import text as txt
12
12
 
13
13
  DEFAULT_GEOMETRY = '400x200'
14
14
  HISTORY_GEOMETRY = '800x750'
@@ -116,7 +116,7 @@ class AboutFrame():
116
116
  button.grid(row=0, column=0, padx=Pad.W, sticky=tk.E)
117
117
 
118
118
  button = ttk.Button(
119
- frame, text=text.EXIT, command=self.dismiss, underline=1)
119
+ frame, text=txt.EXIT, command=self.dismiss, underline=1)
120
120
  button.grid(row=0, column=1, padx=Pad.W, sticky=tk.E)
121
121
 
122
122
  return frame
@@ -205,7 +205,7 @@ class HistoryFrame():
205
205
  frame.columnconfigure(0, weight=1)
206
206
 
207
207
  button = ttk.Button(
208
- frame, text=text.EXIT, command=self.dismiss, underline=1)
208
+ frame, text=txt.EXIT, command=self.dismiss, underline=1)
209
209
  button.grid(row=0, column=0, padx=Pad.W, sticky=tk.E)
210
210
  return frame
211
211
 
psiutils/_logger.py ADDED
@@ -0,0 +1,54 @@
1
+ import logging
2
+ from logging.handlers import RotatingFileHandler
3
+ import structlog
4
+
5
+ # === 1. Console handler with pretty dev output ===
6
+ console_handler = logging.StreamHandler()
7
+ console_handler.setLevel(logging.INFO)
8
+ console_handler.setFormatter(
9
+ structlog.stdlib.ProcessorFormatter(
10
+ processor=structlog.dev.ConsoleRenderer(),
11
+ foreign_pre_chain=[
12
+ structlog.processors.TimeStamper(fmt="iso"),
13
+ ],
14
+ )
15
+ )
16
+
17
+ # === 2. File handler with JSON output ===
18
+ file_handler = RotatingFileHandler(
19
+ "app.log", maxBytes=5_000_000, backupCount=5, encoding="utf-8"
20
+ )
21
+ file_handler.setLevel(logging.INFO)
22
+ file_handler.setFormatter(
23
+ structlog.stdlib.ProcessorFormatter(
24
+ processor=structlog.processors.JSONRenderer(), # Structured JSON
25
+ foreign_pre_chain=[
26
+ structlog.processors.TimeStamper(fmt="iso"),
27
+ ],
28
+ )
29
+ )
30
+
31
+ # === 3. Attach both handlers ===
32
+ root_logger = logging.getLogger()
33
+ root_logger.setLevel(logging.INFO)
34
+ root_logger.addHandler(console_handler)
35
+ root_logger.addHandler(file_handler)
36
+
37
+ # === 4. Configure structlog to use stdlib logging ===
38
+ structlog.configure(
39
+ processors=[
40
+ structlog.processors.TimeStamper(fmt="iso"),
41
+ structlog.stdlib.add_log_level,
42
+ structlog.stdlib.add_logger_name,
43
+ structlog.stdlib.PositionalArgumentsFormatter(),
44
+ structlog.processors.StackInfoRenderer(),
45
+ structlog.processors.format_exc_info,
46
+ structlog.stdlib.ProcessorFormatter.wrap_for_formatter,
47
+ ],
48
+ wrapper_class=structlog.make_filtering_bound_logger(logging.INFO),
49
+ context_class=dict,
50
+ logger_factory=structlog.stdlib.LoggerFactory(),
51
+ cache_logger_on_first_use=True,
52
+ )
53
+
54
+ logger = structlog.get_logger()
psiutils/_version.py CHANGED
@@ -1 +1 @@
1
- __version__ = '0.1.69'
1
+ __version__ = '0.1.71'
psiutils/utilities.py CHANGED
@@ -6,7 +6,8 @@ from typing import Any
6
6
  import platform
7
7
 
8
8
  from psiconfig import TomlConfig
9
- import psiutils.text as text
9
+ from psiutils._logger import logger
10
+ import psiutils.text as txt
10
11
 
11
12
  DEFAULT_GEOMETRY = '500x400'
12
13
 
@@ -19,7 +20,7 @@ def display_icon(root: tk.Tk, icon_file_path: str,
19
20
  icon = tk.PhotoImage(master=root, file=icon_file_path)
20
21
  root.wm_iconphoto(True, icon)
21
22
  except tk.TclError as err:
22
- if ignore_error and text.NO_SUCH_FILE in str(err):
23
+ if ignore_error and txt.NO_SUCH_FILE in str(err):
23
24
  return
24
25
  print(f'Cannot find icon file: {icon_file_path}')
25
26
 
@@ -30,7 +31,7 @@ class Enum():
30
31
 
31
32
 
32
33
  def confirm_delete(parent: Any) -> str:
33
- question = text.DELETE_THESE_ITEMS
34
+ question = txt.DELETE_THESE_ITEMS
34
35
  return tk.messagebox.askquestion(
35
36
  'Delete items', question, icon='warning', parent=parent)
36
37
 
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.3
2
2
  Name: psiutils
3
- Version: 0.1.69
3
+ Version: 0.1.71
4
4
  Summary: Various TKinter utilities.
5
5
  Author: Jeff
6
6
  Author-email: Jeff <<jeffwatkins2000@gmail.com>>
@@ -1,6 +1,7 @@
1
1
  psiutils/__init__.py,sha256=07c98b1c26029c3d0b730b0602d4b71ccf6461dc159e17fa74d5cbea2d47e246,145
2
- psiutils/_about_frame.py,sha256=bf6b1b848b2fc1c890addf57fb738e8891b09873f3ebdcc772a975cca7fbfbb8,7634
3
- psiutils/_version.py,sha256=6d6f9927cb2675382781c7c3ce9b7953b43119a4955f53f8a5ed827d8ac550d0,22
2
+ psiutils/_about_frame.py,sha256=c59422bf0bd973e93c0be4a4c109def9d06be206af0c02ffdf67eff04fbb5add,7644
3
+ psiutils/_logger.py,sha256=e76067d9d01c0e6e781bb56c1f88c321944cd603171ee99508f7d5cce4bed57e,1725
4
+ psiutils/_version.py,sha256=fe37c8ddf31d3ff45b75a483f6c1864757a84c89fdbd5669ce4b9602ddd9644f,22
4
5
  psiutils/buttons.py,sha256=4436d5543591e86fc5cfdedbb0eee75385893c6d4a32989592d1da3f7b8f804b,8370
5
6
  psiutils/constants.py,sha256=4fc023601926bb38805a35e038df928f400ceb63401a5ba3fd8ea096b3856c77,1107
6
7
  psiutils/drag_manager.py,sha256=2f4e06cca2229d65f31826b0bd39e7d7c175004b7c3d43d2d54f87a8256b878f,3470
@@ -43,8 +44,8 @@ psiutils/menus.py,sha256=e295076f77c46332e7b1fb7174a07f36394faf28ffa6eed6379232e
43
44
  psiutils/messagebox.py,sha256=d785b82b3120f058b538288e5fdcd9be89a84aa89b018362a50a5af794dca393,4969
44
45
  psiutils/text.py,sha256=b67bc67d180df70c67b57306f587a25af91318a249d3cc9e142e9249f520f483,738
45
46
  psiutils/treeview.py,sha256=8ed4b32d6ae7148043595e58856351a19c205be2a3f3fed756a672bacafeae24,2826
46
- psiutils/utilities.py,sha256=0f06fcd059d9973ae6fae72365504b89243216b7080b7542957db4d4bfee81de,3074
47
+ psiutils/utilities.py,sha256=0ab732a14324d9df5665cbfbc9a84225d5a1a5a18ceeec777523f9904bd0a1e0,3107
47
48
  psiutils/widgets.py,sha256=a28180cb4214ddcb7d69eaa706a314af6015caa83fcca1c6f059bd1a6f969f96,11114
48
- psiutils-0.1.69.dist-info/WHEEL,sha256=93de19be7d53119d6ff54257ff9c5f7ccc85e74dcd153606ae40561b2cc06a21,78
49
- psiutils-0.1.69.dist-info/METADATA,sha256=700abed486b0da1a1c2e2c6f7d29be83eeba70b9ef573ab0c34e02be8faca5e9,1977
50
- psiutils-0.1.69.dist-info/RECORD,,
49
+ psiutils-0.1.71.dist-info/WHEEL,sha256=0f7d664a881437bddec71c703c3c2f01fd13581519f95130abcc96e296ef0426,79
50
+ psiutils-0.1.71.dist-info/METADATA,sha256=acbe7bab2ee779b03e8da85c2332d941afa4b99af41bf517246deafb3dbc936c,1977
51
+ psiutils-0.1.71.dist-info/RECORD,,
@@ -1,4 +1,4 @@
1
1
  Wheel-Version: 1.0
2
- Generator: uv 0.8.8
2
+ Generator: uv 0.8.11
3
3
  Root-Is-Purelib: true
4
4
  Tag: py3-none-any