easy-utils-dev 2.150__tar.gz → 2.152__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.
Potentially problematic release.
This version of easy-utils-dev might be problematic. Click here for more details.
- {easy_utils_dev-2.150 → easy_utils_dev-2.152}/PKG-INFO +1 -1
- {easy_utils_dev-2.150 → easy_utils_dev-2.152}/easy_utils_dev/debugger.py +36 -47
- {easy_utils_dev-2.150 → easy_utils_dev-2.152}/easy_utils_dev/utils.py +4 -1
- {easy_utils_dev-2.150 → easy_utils_dev-2.152}/easy_utils_dev.egg-info/PKG-INFO +1 -1
- {easy_utils_dev-2.150 → easy_utils_dev-2.152}/setup.py +1 -1
- {easy_utils_dev-2.150 → easy_utils_dev-2.152}/MANIFEST.in +0 -0
- {easy_utils_dev-2.150 → easy_utils_dev-2.152}/easy_utils_dev/EasySsh.py +0 -0
- {easy_utils_dev-2.150 → easy_utils_dev-2.152}/easy_utils_dev/Events.py +0 -0
- {easy_utils_dev-2.150 → easy_utils_dev-2.152}/easy_utils_dev/FastQueue.py +0 -0
- {easy_utils_dev-2.150 → easy_utils_dev-2.152}/easy_utils_dev/NameObject.py +0 -0
- {easy_utils_dev-2.150 → easy_utils_dev-2.152}/easy_utils_dev/__init__.py +0 -0
- {easy_utils_dev-2.150 → easy_utils_dev-2.152}/easy_utils_dev/abortable.py +0 -0
- {easy_utils_dev-2.150 → easy_utils_dev-2.152}/easy_utils_dev/brevosmtp.py +0 -0
- {easy_utils_dev-2.150 → easy_utils_dev-2.152}/easy_utils_dev/check_license.py +0 -0
- {easy_utils_dev-2.150 → easy_utils_dev-2.152}/easy_utils_dev/cplib.py +0 -0
- {easy_utils_dev-2.150 → easy_utils_dev-2.152}/easy_utils_dev/custom_env.py +0 -0
- {easy_utils_dev-2.150 → easy_utils_dev-2.152}/easy_utils_dev/debugger-C-PF4PAMMP.py +0 -0
- {easy_utils_dev-2.150 → easy_utils_dev-2.152}/easy_utils_dev/easy_oracle.py +0 -0
- {easy_utils_dev-2.150 → easy_utils_dev-2.152}/easy_utils_dev/encryptor.py +0 -0
- {easy_utils_dev-2.150 → easy_utils_dev-2.152}/easy_utils_dev/ept.py +0 -0
- {easy_utils_dev-2.150 → easy_utils_dev-2.152}/easy_utils_dev/ept_sql/create_dirs.sql +0 -0
- {easy_utils_dev-2.150 → easy_utils_dev-2.152}/easy_utils_dev/ept_sql/create_ept_tables.sql +0 -0
- {easy_utils_dev-2.150 → easy_utils_dev-2.152}/easy_utils_dev/exceptions.py +0 -0
- {easy_utils_dev-2.150 → easy_utils_dev-2.152}/easy_utils_dev/filescompressor.py +0 -0
- {easy_utils_dev-2.150 → easy_utils_dev-2.152}/easy_utils_dev/generate_license.py +0 -0
- {easy_utils_dev-2.150 → easy_utils_dev-2.152}/easy_utils_dev/keycloakapi.py +0 -0
- {easy_utils_dev-2.150 → easy_utils_dev-2.152}/easy_utils_dev/lralib.py +0 -0
- {easy_utils_dev-2.150 → easy_utils_dev-2.152}/easy_utils_dev/ne1830PSS.py +0 -0
- {easy_utils_dev-2.150 → easy_utils_dev-2.152}/easy_utils_dev/nsp_kafka.py +0 -0
- {easy_utils_dev-2.150 → easy_utils_dev-2.152}/easy_utils_dev/openid_server.py +0 -0
- {easy_utils_dev-2.150 → easy_utils_dev-2.152}/easy_utils_dev/optics_utils.py +0 -0
- {easy_utils_dev-2.150 → easy_utils_dev-2.152}/easy_utils_dev/require_auth.py +0 -0
- {easy_utils_dev-2.150 → easy_utils_dev-2.152}/easy_utils_dev/simple_sqlite.py +0 -0
- {easy_utils_dev-2.150 → easy_utils_dev-2.152}/easy_utils_dev/temp_memory.py +0 -0
- {easy_utils_dev-2.150 → easy_utils_dev-2.152}/easy_utils_dev/uiserver.py +0 -0
- {easy_utils_dev-2.150 → easy_utils_dev-2.152}/easy_utils_dev/winserviceapi.py +0 -0
- {easy_utils_dev-2.150 → easy_utils_dev-2.152}/easy_utils_dev/wsnoclib.py +0 -0
- {easy_utils_dev-2.150 → easy_utils_dev-2.152}/easy_utils_dev/wsselib.py +0 -0
- {easy_utils_dev-2.150 → easy_utils_dev-2.152}/easy_utils_dev.egg-info/SOURCES.txt +0 -0
- {easy_utils_dev-2.150 → easy_utils_dev-2.152}/easy_utils_dev.egg-info/dependency_links.txt +0 -0
- {easy_utils_dev-2.150 → easy_utils_dev-2.152}/easy_utils_dev.egg-info/requires.txt +0 -0
- {easy_utils_dev-2.150 → easy_utils_dev-2.152}/easy_utils_dev.egg-info/top_level.txt +0 -0
- {easy_utils_dev-2.150 → easy_utils_dev-2.152}/setup.cfg +0 -0
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
import logging
|
|
2
2
|
import os
|
|
3
|
+
import shutil
|
|
3
4
|
import sys
|
|
4
5
|
from datetime import datetime
|
|
5
6
|
from logging.handlers import RotatingFileHandler
|
|
6
|
-
from .utils import getRandomKey , convert_mb_to_bytes , getTimestamp , start_thread
|
|
7
|
+
from .utils import getRandomKey , convert_mb_to_bytes , getTimestamp, mkdirs , start_thread
|
|
7
8
|
from .custom_env import custom_env , setupEnvironment
|
|
8
9
|
from .Events import EventEmitter
|
|
9
10
|
from threading import Thread
|
|
@@ -58,12 +59,11 @@ class DEBUGGER:
|
|
|
58
59
|
self.file_handler_class=None
|
|
59
60
|
self.LOG_SIZE_THRESHOLD_IN_BYTES = 10 * 1024 * 1024
|
|
60
61
|
self.BACKUP_COUNT = log_rotation
|
|
61
|
-
self.
|
|
62
|
-
self.
|
|
62
|
+
self.name = name
|
|
63
|
+
self.create_log_path(homePath, file_name)
|
|
63
64
|
self.fullSyntax=fullSyntax
|
|
64
65
|
self.onScreen= onscreen
|
|
65
66
|
self.id = id
|
|
66
|
-
self.how_many_times_write= 0
|
|
67
67
|
self.stream_service = None
|
|
68
68
|
if not env['debugger'].get(name) :
|
|
69
69
|
self.console = console_handler = logging.StreamHandler()
|
|
@@ -71,7 +71,6 @@ class DEBUGGER:
|
|
|
71
71
|
self.console = console_handler = env['debugger'].get(name).console
|
|
72
72
|
if not self.logger.hasHandlers() :
|
|
73
73
|
self.logger.addHandler(self.console)
|
|
74
|
-
self.name = name
|
|
75
74
|
self.rotate_disabled=False
|
|
76
75
|
self.isInPyinstaller = False
|
|
77
76
|
self.log_iterations=0
|
|
@@ -86,13 +85,11 @@ class DEBUGGER:
|
|
|
86
85
|
f = f"[{self.name}]-[%(levelname)s]: %(message)s"
|
|
87
86
|
self.syntax = f
|
|
88
87
|
self.formatter = logging.Formatter(f , datefmt='%Y-%m-%d %H:%M:%S' )
|
|
89
|
-
self.filename = file_name
|
|
90
|
-
path = self.homepath(homePath)
|
|
91
88
|
if not env['debugger'].get(name) :
|
|
92
89
|
console_handler.setFormatter(self.formatter)
|
|
93
90
|
if not disable_log_write :
|
|
94
91
|
if not env['debugger'].get(name) :
|
|
95
|
-
self.file_handler_class = self.createRotateFileHandler(
|
|
92
|
+
self.file_handler_class = self.createRotateFileHandler(self.log_path_with_filename)
|
|
96
93
|
if onscreen :
|
|
97
94
|
self.enable_print()
|
|
98
95
|
elif not onscreen :
|
|
@@ -120,6 +117,20 @@ class DEBUGGER:
|
|
|
120
117
|
self.enable_print()
|
|
121
118
|
start_thread(target=self.checks_in_bg)
|
|
122
119
|
|
|
120
|
+
def create_log_path(self , base_path , logname ) :
|
|
121
|
+
if not base_path :
|
|
122
|
+
base_path = os.path.join(os.getcwd() , 'debug')
|
|
123
|
+
if not logname :
|
|
124
|
+
logname = self.name
|
|
125
|
+
mkdirs(base_path)
|
|
126
|
+
self.baseHomePath = base_path
|
|
127
|
+
self.filename = logname
|
|
128
|
+
self.lastAbsoluteHomePath = base_path
|
|
129
|
+
self.log_path_with_filename = os.path.join(base_path, f'{logname}.log')
|
|
130
|
+
# print(f"Filename : {self.filename}")
|
|
131
|
+
# print(f"Base Home Path : {self.baseHomePath}")
|
|
132
|
+
# print(f"Log path With Filename : {self.log_path_with_filename}")
|
|
133
|
+
# print(f"Last Absolute Home Path : {self.lastAbsoluteHomePath}")
|
|
123
134
|
|
|
124
135
|
def fix_file_not_found_file_rotation(self) :
|
|
125
136
|
for i in range(self.BACKUP_COUNT) :
|
|
@@ -128,7 +139,7 @@ class DEBUGGER:
|
|
|
128
139
|
# print(f"Checking log file path : {file_path}")
|
|
129
140
|
if not os.path.exists(file_path) :
|
|
130
141
|
with open(file_path, 'a+') as f :
|
|
131
|
-
print(f"Creating log file path : {file_path}")
|
|
142
|
+
# print(f"Creating log file path : {file_path}")
|
|
132
143
|
f.write('')
|
|
133
144
|
except :
|
|
134
145
|
pass
|
|
@@ -155,9 +166,10 @@ class DEBUGGER:
|
|
|
155
166
|
def updateGlobalHomePath(self ) :
|
|
156
167
|
if not self.isLogWriteDisabled :
|
|
157
168
|
getFromEnv = self.env.get('debugger_homepath' , None )
|
|
158
|
-
|
|
169
|
+
print(f"getFromEnv : {getFromEnv}")
|
|
170
|
+
self.create_log_path(getFromEnv, self.filename)
|
|
159
171
|
if getFromEnv :
|
|
160
|
-
self.file_handler_class = self.createRotateFileHandler(self.
|
|
172
|
+
self.file_handler_class = self.createRotateFileHandler(self.log_path_with_filename)
|
|
161
173
|
|
|
162
174
|
def updateGlobalSetLevel( self ) :
|
|
163
175
|
self.set_level(self.env['debugger_global_level'])
|
|
@@ -226,13 +238,7 @@ class DEBUGGER:
|
|
|
226
238
|
self.logger.removeHandler(self.file_handler_class)
|
|
227
239
|
|
|
228
240
|
def enable_log_write(self) :
|
|
229
|
-
self.createRotateFileHandler(self.
|
|
230
|
-
|
|
231
|
-
def manage_file_rotation(self, record ) :
|
|
232
|
-
handler = self.get_rotate_handler()
|
|
233
|
-
if handler.shouldRollover(record) :
|
|
234
|
-
handler.doRollover()
|
|
235
|
-
self.log_iterations = 0
|
|
241
|
+
self.createRotateFileHandler(self.log_path_with_filename)
|
|
236
242
|
|
|
237
243
|
def get_rotate_handler(self) :
|
|
238
244
|
return self.file_handler_class
|
|
@@ -248,11 +254,10 @@ class DEBUGGER:
|
|
|
248
254
|
handler = self.get_rotate_handler()
|
|
249
255
|
handler.maxBytes = size
|
|
250
256
|
return True
|
|
251
|
-
|
|
252
257
|
|
|
253
258
|
def checks_in_bg(self) :
|
|
254
259
|
while True :
|
|
255
|
-
self.fix_file_not_found_file_rotation()
|
|
260
|
+
#self.fix_file_not_found_file_rotation()
|
|
256
261
|
if self.env.get('GLOBAL_DEBUGGER_STREAM_SERVICE') :
|
|
257
262
|
self.addStreamService(socketio=self.env.get('GLOBAL_DEBUGGER_STREAM_SERVICE'))
|
|
258
263
|
if self.env.get('debugger_global_level' , None) :
|
|
@@ -270,7 +275,7 @@ class DEBUGGER:
|
|
|
270
275
|
self.updateGlobalHomePath()
|
|
271
276
|
if os.environ.get("EASY_UTILS_ENABLE_PRINT" , '' ).lower() == 'true' :
|
|
272
277
|
self.enable_print()
|
|
273
|
-
sleep(
|
|
278
|
+
sleep(10)
|
|
274
279
|
|
|
275
280
|
def close(self) :
|
|
276
281
|
try :
|
|
@@ -278,28 +283,6 @@ class DEBUGGER:
|
|
|
278
283
|
except :
|
|
279
284
|
pass
|
|
280
285
|
|
|
281
|
-
def homepath(self , path=None ) :
|
|
282
|
-
env = custom_env()
|
|
283
|
-
getFromEnv = env.get('debugger_homepath' , None )
|
|
284
|
-
if getFromEnv is not None :
|
|
285
|
-
self.homePath = getFromEnv
|
|
286
|
-
else :
|
|
287
|
-
if path is not None :
|
|
288
|
-
if self.homePath and '.log' in str(self.homePath):
|
|
289
|
-
self.lastAbsoluteHomePath= self.homePath
|
|
290
|
-
self.homePath = path
|
|
291
|
-
else :
|
|
292
|
-
self.homePath = os.path.join(os.getcwd() , 'debug')
|
|
293
|
-
if not os.path.exists( self.homePath ) :
|
|
294
|
-
try :
|
|
295
|
-
os.makedirs( self.homePath )
|
|
296
|
-
except :
|
|
297
|
-
pass
|
|
298
|
-
if self.filename :
|
|
299
|
-
self.homePath = os.path.join( self.homePath, f'{self.filename}.log' )
|
|
300
|
-
else :
|
|
301
|
-
self.homePath = os.path.join( self.homePath, f'{self.name}.log' )
|
|
302
|
-
return self.homePath
|
|
303
286
|
|
|
304
287
|
def get_current_levels(self):
|
|
305
288
|
"""
|
|
@@ -328,10 +311,16 @@ class DEBUGGER:
|
|
|
328
311
|
self.logger.removeHandler(self.console)
|
|
329
312
|
|
|
330
313
|
def changeHomePath( self , path ) :
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
314
|
+
def delet_later(lastAbsoluteHomePath) :
|
|
315
|
+
if lastAbsoluteHomePath :
|
|
316
|
+
sleep(3)
|
|
317
|
+
try :
|
|
318
|
+
shutil.rmtree(lastAbsoluteHomePath)
|
|
319
|
+
except :
|
|
320
|
+
pass
|
|
321
|
+
start_thread(target=delet_later, args=[self.lastAbsoluteHomePath])
|
|
322
|
+
self.create_log_path( path , self.filename)
|
|
323
|
+
self.file_handler_class = self.createRotateFileHandler(self.log_path_with_filename)
|
|
335
324
|
|
|
336
325
|
def isGlobalDebuggerDefined(self) :
|
|
337
326
|
if self.global_debugger :
|
|
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
|
|
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
|