logfore 2.1.3.1__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.
logfore/__init__.py ADDED
@@ -0,0 +1,7 @@
1
+ # logfore/__init__.py
2
+
3
+ from .logger import Logger, Loader, Home, LogLevel
4
+ from .updater import AutoUpdater
5
+ from .version import __version__
6
+
7
+ __all__ = ["Logger", "Loader", "Home", "LogLevel", "AutoUpdater", "__version__"]
logfore/font.py ADDED
@@ -0,0 +1,605 @@
1
+ ascii_art = {
2
+ 'A': [
3
+ r' /$$$$$$ ',
4
+ r' /$$__ $$ ',
5
+ r'| $$ \ $$ ',
6
+ r'| $$$$$$$$ ',
7
+ r'| $$__ $$ ',
8
+ r'| $$ | $$ ',
9
+ r'| $$ | $$ ',
10
+ r'|__/ |__/'
11
+ ],
12
+ 'B': [
13
+ r' /$$$$$$$ ',
14
+ r'| $$__ $$ ',
15
+ r'| $$ \ $$ ',
16
+ r'| $$$$$$$ ',
17
+ r'| $$__ $$ ',
18
+ r'| $$ \ $$ ',
19
+ r'| $$$$$$$/ ',
20
+ r'|_______/ '
21
+ ],
22
+ 'C': [
23
+ r' /$$$$$$ ',
24
+ r' /$$__ $$ ',
25
+ r'| $$ \__/ ',
26
+ r'| $$ ',
27
+ r'| $$ ',
28
+ r'| $$ $$ ',
29
+ r'| $$$$$$/ ',
30
+ r' \______/ '
31
+ ],
32
+ 'D': [
33
+ r' /$$$$$$$ ',
34
+ r'| $$__ $$ ',
35
+ r'| $$ \ $$ ',
36
+ r'| $$ | $$ ',
37
+ r'| $$ | $$ ',
38
+ r'| $$ | $$ ',
39
+ r'| $$$$$$$/ ',
40
+ r'|_______/ '
41
+ ],
42
+ 'E': [
43
+ r' /$$$$$$$$ ',
44
+ r'| $$_____/ ',
45
+ r'| $$ ',
46
+ r'| $$$$$ ',
47
+ r'| $$__/ ',
48
+ r'| $$ ',
49
+ r'| $$$$$$$$ ',
50
+ r'|________/ '
51
+ ],
52
+ 'F': [
53
+ r' /$$$$$$$$ ',
54
+ r'| $$_____/ ',
55
+ r'| $$ ',
56
+ r'| $$$$$ ',
57
+ r'| $$__/ ',
58
+ r'| $$ ',
59
+ r'| $$ ',
60
+ r'|__/ '
61
+ ],
62
+ 'G': [
63
+ r' /$$$$$$ ',
64
+ r' /$$__ $$ ',
65
+ r'| $$ \__/ ',
66
+ r'| $$ /$$$$ ',
67
+ r'| $$|_ $$ ',
68
+ r'| $$ \ $$ ',
69
+ r'| $$$$$$/ ',
70
+ r' \______/ '
71
+ ],
72
+ 'H': [
73
+ r' /$$ /$$ ',
74
+ r'| $$ | $$ ',
75
+ r'| $$ | $$ ',
76
+ r'| $$$$$$$$ ',
77
+ r'| $$__ $$ ',
78
+ r'| $$ | $$ ',
79
+ r'| $$ | $$ ',
80
+ r'|__/ |__/ '
81
+ ],
82
+ 'I': [
83
+ r' /$$$$$$ ',
84
+ r'|_ $$_/ ',
85
+ r' | $$ ',
86
+ r' | $$ ',
87
+ r' | $$ ',
88
+ r' | $$ ',
89
+ r' /$$$$$$ ',
90
+ r'|______/ '
91
+ ],
92
+ 'J': [
93
+ r' /$$$$$ ',
94
+ r' |__ $$ ',
95
+ r' | $$ ',
96
+ r' | $$ ',
97
+ r' /$$ | $$ ',
98
+ r'| $$ | $$ ',
99
+ r'| $$$$$$/ ',
100
+ r' \______/ '
101
+ ],
102
+ 'K': [
103
+ r' /$$ /$$ ',
104
+ r'| $$ /$$/ ',
105
+ r'| $$ /$$/ ',
106
+ r'| $$$$$/ ',
107
+ r'| $$ $$ ',
108
+ r'| $$\ $$ ',
109
+ r'| $$ \ $$ ',
110
+ r'|__/ \__/ '
111
+ ],
112
+ 'L': [
113
+ r' /$$ ',
114
+ r'| $$ ',
115
+ r'| $$ ',
116
+ r'| $$ ',
117
+ r'| $$ ',
118
+ r'| $$ ',
119
+ r'| $$$$$$$$ ',
120
+ r'|________/ '
121
+ ],
122
+ 'M': [
123
+ r' /$$ /$$ ',
124
+ r'| $$$ /$$$ ',
125
+ r'| $$$$ /$$$$ ',
126
+ r'| $$ $$/$$ $$ ',
127
+ r'| $$ $$$| $$ ',
128
+ r'| $$\ $ | $$ ',
129
+ r'| $$ \/ | $$ ',
130
+ r'|__/ |__/ '
131
+ ],
132
+ 'N': [
133
+ r' /$$ /$$ ',
134
+ r'| $$$ | $$ ',
135
+ r'| $$$$| $$ ',
136
+ r'| $$ $$ $$ ',
137
+ r'| $$ $$$$ ',
138
+ r'| $$\ $$$ ',
139
+ r'| $$ \ $$ ',
140
+ r'|__/ \__/ '
141
+ ],
142
+ 'O': [
143
+ r' /$$$$$$ ',
144
+ r' /$$__ $$ ',
145
+ r'| $$ \ $$ ',
146
+ r'| $$ | $$ ',
147
+ r'| $$ | $$ ',
148
+ r'| $$ | $$ ',
149
+ r'| $$$$$$/ ',
150
+ r' \______/ '
151
+ ],
152
+ 'P': [
153
+ r' /$$$$$$$ ',
154
+ r'| $$__ $$ ',
155
+ r'| $$ \ $$ ',
156
+ r'| $$$$$$$/ ',
157
+ r'| $$____/ ',
158
+ r'| $$ ',
159
+ r'| $$ ',
160
+ r'|__/ '
161
+ ],
162
+ 'Q': [
163
+ r' /$$$$$$ ',
164
+ r' /$$__ $$ ',
165
+ r'| $$ \ $$ ',
166
+ r'| $$ | $$ ',
167
+ r'| $$/$$ $$ ',
168
+ r'| $$$$$$/ ',
169
+ r' \____ $$$ ',
170
+ r' \__/ ',
171
+ ],
172
+ 'R': [
173
+ r' /$$$$$$$ ',
174
+ r'| $$__ $$ ',
175
+ r'| $$ \ $$ ',
176
+ r'| $$$$$$$/ ',
177
+ r'| $$__ $$ ',
178
+ r'| $$ \ $$ ',
179
+ r'| $$ | $$ ',
180
+ r'|__/ |__/ '
181
+ ],
182
+ 'S': [
183
+ r' /$$$$$$ ',
184
+ r' /$$__ $$ ',
185
+ r'| $$ \__/ ',
186
+ r'| $$$$$$ ',
187
+ r' \____ $$ ',
188
+ r' /$$ \ $$ ',
189
+ r'| $$$$$$/ ',
190
+ r' \______/ '
191
+ ],
192
+ 'T': [
193
+ r' /$$$$$$$$ ',
194
+ r'|__ $$__/ ',
195
+ r' | $$ ',
196
+ r' | $$ ',
197
+ r' | $$ ',
198
+ r' | $$ ',
199
+ r' | $$ ',
200
+ r' |__/ '
201
+ ],
202
+ 'U': [
203
+ r' /$$ /$$ ',
204
+ r'| $$ | $$ ',
205
+ r'| $$ | $$ ',
206
+ r'| $$ | $$ ',
207
+ r'| $$ | $$ ',
208
+ r'| $$ | $$ ',
209
+ r'| $$$$$$/ ',
210
+ r' \______/ '
211
+ ],
212
+ 'V': [
213
+ r' /$$ /$$ ',
214
+ r'| $$ | $$ ',
215
+ r'| $$ | $$ ',
216
+ r'| $$ / $$/ ',
217
+ r' \ $$ $$/ ',
218
+ r' \ $$$/ ',
219
+ r' \ $/ ',
220
+ r' \_/ '
221
+ ],
222
+ 'W': [
223
+ r' /$$ /$$ ',
224
+ r'| $$ /$ | $$ ',
225
+ r'| $$ /$$$| $$ ',
226
+ r'| $$/$$ $$ $$ ',
227
+ r'| $$$$_ $$$$ ',
228
+ r'| $$$/ \ $$$ ',
229
+ r'| $$/ \ $$ ',
230
+ r'|__/ \__/ ',
231
+ ],
232
+ 'X': [
233
+ r' /$$ /$$ ',
234
+ r'| $$ / $$ ',
235
+ r'| $$/ $$/ ',
236
+ r' \ $$$$/ ',
237
+ r' >$$ $$ ',
238
+ r' /$$/\ $$ ',
239
+ r'| $$ \ $$ ',
240
+ r'|__/ \__/ ',
241
+ ],
242
+ 'Y': [
243
+ r' /$$ /$$ ',
244
+ r'| $$ /$$/ ',
245
+ r' \ $$ /$$/ ',
246
+ r' \ $$$$/ ',
247
+ r' \ $$/ ',
248
+ r' | $$ ',
249
+ r' | $$ ',
250
+ r' |__/ ',
251
+ ],
252
+ 'Z': [
253
+ r' /$$$$$$$$ ',
254
+ r'|_____ $$ ',
255
+ r' /$$/ ',
256
+ r' /$$/ ',
257
+ r' /$$/ ',
258
+ r' /$$/ ',
259
+ r' /$$$$$$$$ ',
260
+ r'|________/ ',
261
+ ],
262
+ 'a': [
263
+ r' /$$$$$$ ',
264
+ r' |____ $$ ',
265
+ r' /$$$$$$$ ',
266
+ r' /$$__ $$ ',
267
+ r'| $$$$$$$ ',
268
+ r' \_______/ ',
269
+ ],
270
+ 'b': [
271
+ r' /$$ ',
272
+ r'| $$ ',
273
+ r'| $$$$$$$ ',
274
+ r'| $$ $$ ',
275
+ r'| $$$$$$$/ ',
276
+ r'|_______/ '
277
+ ],
278
+ 'c': [
279
+ r' /$$$$$$$ ',
280
+ r' /$$_____/ ',
281
+ r'| $$ ',
282
+ r'| $$ ',
283
+ r'| $$$$$$$ ',
284
+ r' \_______/ '
285
+ ],
286
+ 'd': [
287
+ r' /$$ ',
288
+ r' | $$ ',
289
+ r' /$$$$$$$ ',
290
+ r' /$$ $$ ',
291
+ r'| $$$$$$$ ',
292
+ r' \_______/ '
293
+ ],
294
+ 'e': [
295
+ r' /$$$$$$ ',
296
+ r' /$$__ $$ ',
297
+ r'| $$$$$$$$ ',
298
+ r'| $$_____/ ',
299
+ r'| $$$$$$$ ',
300
+ r' \_______/ '
301
+ ],
302
+ 'f': [
303
+ r' /$$$$$$ ',
304
+ r' /$$__ $$ ',
305
+ r'| $$ \__/ ',
306
+ r'| $$$$ ',
307
+ r'| $$| ',
308
+ r'|___| '
309
+ ],
310
+ 'g': [
311
+ r' /$$$$$$ ',
312
+ r' /$$ $$ ',
313
+ r'| $$$$$$$ ',
314
+ r' \____ $$ ',
315
+ r' /$$ \ $$ ',
316
+ r'| $$$$$$/ ',
317
+ ],
318
+ 'h': [
319
+ r' /$$ ',
320
+ r'| $$ ',
321
+ r'| $$$$$$$ ',
322
+ r'| $$__ $$ ',
323
+ r'| $$ \ $$ ',
324
+ r'|__/ |__/ '
325
+ ],
326
+ 'i': [
327
+ r' /$$ ',
328
+ r'|__/ ',
329
+ r' /$$ ',
330
+ r'| $$ ',
331
+ r'| $$ ',
332
+ r'|__/ '
333
+ ],
334
+ 'j': [
335
+
336
+ r' /$$ ',
337
+ r' |__/ ',
338
+ r' /$$ ',
339
+ r' /$$ | $$ ',
340
+ r'| $$$$$$/ ',
341
+ r' \______/ '
342
+ ],
343
+ 'k': [
344
+ r' /$$ /$$ ',
345
+ r'| $$ /$$/ ',
346
+ r'| $$$$$$/ ',
347
+ r'| $$_ $$ ',
348
+ r'| $$ \ $$ ',
349
+ r'|__/ \__/ '
350
+ ],
351
+ 'l': [
352
+ r' /$$ ',
353
+ r'| $$ ',
354
+ r'| $$ ',
355
+ r'| $$ ',
356
+ r'| $$ ',
357
+ r'|__/ '
358
+ ],
359
+ 'm': [
360
+ r' /$$$$$$/$$$$ ',
361
+ r'| $$_ $$_ $$ ',
362
+ r'| $$ \ $$ \ $$ ',
363
+ r'| $$ | $$ | $$ ',
364
+ r'| $$ | $$ | $$ ',
365
+ r'|__/ |__/ |__/ '
366
+ ],
367
+ 'n': [
368
+ r' /$$$$$$$ ',
369
+ r'| $$__ $$ ',
370
+ r'| $$ \ $$ ',
371
+ r'| $$ | $$ ',
372
+ r'| $$ | $$ ',
373
+ r'|__/ |__/ '
374
+ ],
375
+ 'o': [
376
+ r' /$$$$$$ ',
377
+ r' /$$__ $$ ',
378
+ r'| $$ \ $$ ',
379
+ r'| $$ | $$ ',
380
+ r'| $$$$$$/ ',
381
+ r' \______/ '
382
+ ],
383
+ 'p': [
384
+ r' /$$$$$$ ',
385
+ r' /$$ $$ ',
386
+ r'| $$$$$$$/ ',
387
+ r'| $$____/ ',
388
+ r'| $$ ',
389
+ r'|__/ '
390
+ ],
391
+ 'q': [
392
+
393
+ r' /$$$$$$ ',
394
+ r' /$$ $$ ',
395
+ r'| $$$$$$$ ',
396
+ r' \____ $$ ',
397
+ r' | $$ ',
398
+ r' |__/ '
399
+ ],
400
+ 'r': [
401
+
402
+ r' /$$$$$$ ',
403
+ r' /$$__ $$ ',
404
+ r'| $$ \__/ ',
405
+ r'| $$ ',
406
+ r'| $$ ',
407
+ r'|__/ ',
408
+ ],
409
+ 's': [
410
+ r' /$$$$$$$ ',
411
+ r' /$$_____/ ',
412
+ r'| $$$$$$ ',
413
+ r' \____ $$ ',
414
+ r' /$$$$$$$/ ',
415
+ r'|_______/ ',
416
+ ],
417
+ 't': [
418
+
419
+
420
+ r' | $$ ',
421
+ r' /$$$$$$ ',
422
+ r'|_ $$_/ ',
423
+ r' | $$ ',
424
+ r' | $$$ ',
425
+ r' \___/ ',
426
+ ],
427
+
428
+ 'u': [
429
+ r' /$$ /$$ ',
430
+ r'| $$ | $$ ',
431
+ r'| $$ | $$ ',
432
+ r'| $$ | $$ ',
433
+ r'| $$$$$$/ ',
434
+ r' \______/ ',
435
+ ],
436
+ 'v': [
437
+
438
+ r' /$$ /$$ ',
439
+ r'| $$ /$$/ ',
440
+ r' \ $$/$$/ ',
441
+ r' \ $$$/ ',
442
+ r' \ $/ ',
443
+ r' \_/ '
444
+ ],
445
+ 'w': [
446
+ r' /$$ /$$ /$$ ',
447
+ r'| $$ | $$ | $$ ',
448
+ r'| $$ | $$ | $$ ',
449
+ r'| $$ | $$ | $$ ',
450
+ r'| $$$$$/$$$$/ ',
451
+ r' \_____\___/ ',
452
+ ],
453
+
454
+ 'x': [
455
+
456
+ r' /$$ /$$ ',
457
+ r'| $$ /$$/ ',
458
+ r' \ $$$$/ ',
459
+ r' >$$ $$ ',
460
+ r' /$$/\ $$ ',
461
+ r'|__/ \__/ ',
462
+ ],
463
+ 'y': [
464
+ r' /$$ /$$ ',
465
+ r'| $$ | $$ ',
466
+ r'| $$$$$$$ ',
467
+ r' \____ $$ ',
468
+ r'| $$$$$$/ ',
469
+ r' \______/ ',
470
+
471
+ ],
472
+ 'z': [
473
+ r' /$$$$$$$$ ',
474
+ r'|____ /$$/ ',
475
+ r' /$$$$/ ',
476
+ r' /$$__/ ',
477
+ r' /$$$$$$$$ ',
478
+ r'|________/ '
479
+ ],
480
+ "0": [
481
+ r' /$$$$$$ ',
482
+ r' /$$$_ $$ ',
483
+ r'| $$$$\ $$ ',
484
+ r'| $$ $$ $$ ',
485
+ r'| $$\ $$$$ ',
486
+ r'| $$ \ $$$ ',
487
+ r'| $$$$$$/ ',
488
+ r' \______/ ',
489
+
490
+ ],
491
+
492
+ "1": [
493
+ r' /$$ ',
494
+ r' /$$$$ ',
495
+ r'|_ $$ ',
496
+ r' | $$ ',
497
+ r' | $$ ',
498
+ r' | $$ ',
499
+ r' /$$$$$$ ',
500
+ r'|______/ ',
501
+
502
+ ],
503
+
504
+ "2": [
505
+ r' /$$$$$$ ',
506
+ r' /$$__ $$ ',
507
+ r'|__/ \ $$ ',
508
+ r' /$$$$$$/ ',
509
+ r' /$$____/ ',
510
+ r'| $$ ',
511
+ r'| $$$$$$$$ ',
512
+ r'|________/ ',
513
+
514
+ ],
515
+ "3": [
516
+ r' /$$$$$$ ',
517
+ r' /$$__ $$ ',
518
+ r'|__/ \ $$ ',
519
+ r' /$$$$$/ ',
520
+ r' |___ $$ ',
521
+ r' /$$ \ $$ ',
522
+ r'| $$$$$$/ ',
523
+ r' \______/ ',
524
+
525
+ ],
526
+ "4": [
527
+ r' /$$ /$$ ',
528
+ r'| $$ | $$ ',
529
+ r'| $$ | $$ ',
530
+ r'| $$$$$$$$ ',
531
+ r'|_____ $$ ',
532
+ r' | $$ ',
533
+ r' | $$ ',
534
+ r' |__/ ',
535
+
536
+ ],
537
+ "5": [
538
+ r' /$$$$$$$ ',
539
+ r'| $$____/ ',
540
+ r'| $$ ',
541
+ r'| $$$$$$$ ',
542
+ r'|_____ $$ ',
543
+ r' /$$ \ $$ ',
544
+ r'| $$$$$$/ ',
545
+ r' \______/ ',
546
+ ],
547
+ "6": [
548
+ r' /$$$$$$ ',
549
+ r' /$$__ $$ ',
550
+ r'| $$ \__/ ',
551
+ r'| $$$$$$$ ',
552
+ r'| $$__ $$ ',
553
+ r'| $$ \ $$ ',
554
+ r'| $$$$$$/ ',
555
+ r' \______/ ',
556
+
557
+ ],
558
+
559
+ "7": [
560
+ r' /$$$$$$$$ ',
561
+ r'|_____ $$/ ',
562
+ r' /$$/ ',
563
+ r' /$$/ ',
564
+ r' /$$/ ',
565
+ r' /$$/ ',
566
+ r' /$$/ ',
567
+ r'|__/ ',
568
+
569
+ ],
570
+ "8": [
571
+ r' /$$$$$$ ',
572
+ r' /$$__ $$ ',
573
+ r'| $$ \ $$ ',
574
+ r'| $$$$$$/ ',
575
+ r' >$$__ $$ ',
576
+ r'| $$ \ $$ ',
577
+ r'| $$$$$$/ ',
578
+ r' \______/ ',
579
+
580
+ ],
581
+
582
+ "9": [
583
+ r' /$$$$$$ ',
584
+ r' /$$__ $$ ',
585
+ r'| $$ \ $$ ',
586
+ r'| $$$$$$$ ',
587
+ r' \____ $$ ',
588
+ r' /$$ \ $$ ',
589
+ r'| $$$$$$/ ',
590
+ r' \______/ ',
591
+
592
+ ],
593
+ "'": [
594
+ r' /$$ ',
595
+ r'| $/ ',
596
+ r'|_/ ' ,
597
+ r' ',
598
+ r' ',
599
+ r' ',
600
+ r' ',
601
+ r' ',
602
+
603
+ ],
604
+
605
+ }
logfore/logger.py ADDED
@@ -0,0 +1,412 @@
1
+ import datetime
2
+ import time
3
+ from threading import Thread
4
+ from itertools import cycle
5
+ from colorama import Fore, Style
6
+ import os
7
+ import getpass
8
+ from .font import *
9
+ from pystyle import Write, System, Colors
10
+ from enum import Enum
11
+ import re
12
+
13
+ # Repository info tracking at module level
14
+ _repository_info_displayed = False
15
+
16
+ class LogLevel(Enum):
17
+ DEBUG = 1
18
+ INFO = 2
19
+ WARNING = 3
20
+ SUCCESS = 4
21
+ FAILURE = 5
22
+ CRITICAL = 6
23
+
24
+ class Logger:
25
+ def __new__(cls, style: int = 1, *args, **kwargs):
26
+ if cls is Logger:
27
+ if style == 2:
28
+ return SimpleLogger(*args, **kwargs)
29
+ return ColorLogger(*args, **kwargs)
30
+ return super().__new__(cls)
31
+
32
+ def __init__(self, style: int = 1, prefix: str | None = "logfore", github_repository: str = None, level: LogLevel = LogLevel.DEBUG, log_file: str | None = None):
33
+ global _repository_info_displayed
34
+
35
+ self.level = level
36
+ self.repo_url = github_repository
37
+ self.log_file = log_file
38
+ self.prefix = prefix
39
+
40
+ if log_file:
41
+ os.makedirs(os.path.dirname(log_file), exist_ok=True)
42
+ self._write_to_log(f"=== Logging started at {datetime.datetime.now()} ===\n")
43
+
44
+ from .updater import AutoUpdater
45
+ updater = AutoUpdater("logfore", self)
46
+ updater.check_for_updates()
47
+
48
+ def _extract_github_username(self, url: str) -> str | None:
49
+ url = url.replace('https://', '').replace('http://', '').replace('www.', '')
50
+ patterns = [
51
+ r'^github\.com/([^/]+)(?:/.*)?$', # github.com/username or username/repo
52
+ r'^([^/]+)(?:/.*)?$', # username or username/repo
53
+ r'^@(.+)$' # @username
54
+ ]
55
+ for pattern in patterns:
56
+ if match := re.search(pattern, url):
57
+ return match.group(1).rstrip('/ \t\n\r')
58
+
59
+ return None
60
+
61
+ def _write_to_log(self, message: str) -> None:
62
+ if self.log_file:
63
+ try:
64
+ with open(self.log_file, 'a', encoding='utf-8') as f:
65
+ clean_message = self._strip_ansi(message)
66
+ f.write(clean_message + '\n')
67
+ except Exception as e:
68
+ print(f"Error writing to log file: {e}")
69
+
70
+ def _strip_ansi(self, text: str) -> str:
71
+ ansi_escape = re.compile(r'\x1B(?:[@-Z\\-_]|\[[0-?]*[ -/]*[@-~])')
72
+ return ansi_escape.sub('', text)
73
+
74
+ def get_time(self) -> str:
75
+ return datetime.datetime.now().strftime("%H:%M:%S")
76
+
77
+ def _should_log(self, message_level: LogLevel) -> bool:
78
+ return message_level.value >= self.level.value
79
+
80
+ def display_repo_info(self):
81
+ global _repository_info_displayed
82
+
83
+ if self.repo_url and not _repository_info_displayed:
84
+ username = self._extract_github_username(self.repo_url)
85
+ if username:
86
+ self.info(f"Developed by {username} - {self.repo_url}")
87
+ else:
88
+ self.info(f"GitHub Repository: {self.repo_url}")
89
+ _repository_info_displayed = True
90
+
91
+ class ColorLogger(Logger):
92
+ def __init__(self, *args, **kwargs):
93
+ self.WHITE = "\u001b[37m"
94
+ self.MAGENTA = "\033[38;5;97m"
95
+ self.BRIGHT_MAGENTA = "\033[38;2;157;38;255m"
96
+ self.LIGHT_CORAL = "\033[38;5;210m"
97
+ self.RED = "\033[38;5;196m"
98
+ self.GREEN = "\033[38;5;40m"
99
+ self.YELLOW = "\033[38;5;220m"
100
+ self.BLUE = "\033[38;5;21m"
101
+ self.PINK = "\033[38;5;176m"
102
+ self.CYAN = "\033[96m"
103
+ super().__init__(*args, **kwargs)
104
+ self.prefix = f"{self.PINK}[{self.MAGENTA}{self.prefix}{self.PINK}] " if self.prefix else f"{self.PINK}"
105
+
106
+ # Display repo info after initializing colors
107
+ self.display_repo_info()
108
+
109
+ def message3(self, level: str, message: str) -> str:
110
+ current_time = self.get_time()
111
+ return f"{self.prefix}[{self.BRIGHT_MAGENTA}{current_time}{self.PINK}] {self.PINK}[{self.CYAN}{level}{self.PINK}] -> {self.CYAN}{message}{Fore.RESET}"
112
+
113
+ def success(self, message: str, start: int = None, end: int = None, level: str = "Success") -> None:
114
+ if self._should_log(LogLevel.SUCCESS):
115
+ timer = f" {self.BRIGHT_MAGENTA}In{self.WHITE} -> {self.BRIGHT_MAGENTA}{str(float(end) - float(start))[:5]} Seconds {Fore.RESET}" if start and end else ""
116
+ log_message = self.message3(f"{self.GREEN}{level}", f"{self.GREEN}{message}") + timer
117
+ print(log_message)
118
+ self._write_to_log(log_message)
119
+
120
+ def failure(self, message: str, start: int = None, end: int = None, level: str = "Failure") -> None:
121
+ if self._should_log(LogLevel.FAILURE):
122
+ timer = f" {self.BRIGHT_MAGENTA}In{self.WHITE} -> {self.BRIGHT_MAGENTA}{str(float(end) - float(start))[:5]} Seconds {Fore.RESET}" if start and end else ""
123
+ log_message = self.message3(f"{self.RED}{level}", f"{self.RED}{message}") + timer
124
+ print(log_message)
125
+ self._write_to_log(log_message)
126
+
127
+ def error(self, message: str, start: int = None, end: int = None, level: str = "Error") -> None:
128
+ if self._should_log(LogLevel.FAILURE):
129
+ timer = f" {self.BRIGHT_MAGENTA}In{self.WHITE} -> {self.BRIGHT_MAGENTA}{str(float(end) - float(start))[:5]} Seconds {Fore.RESET}" if start and end else ""
130
+ log_message = self.message3(f"{self.RED}{level}", f"{self.RED}{message}") + timer
131
+ print(log_message)
132
+ self._write_to_log(log_message)
133
+
134
+ def warning(self, message: str, start: int = None, end: int = None, level: str = "Warning") -> None:
135
+ if self._should_log(LogLevel.WARNING):
136
+ timer = f" {self.BRIGHT_MAGENTA}In{self.WHITE} -> {self.BRIGHT_MAGENTA}{str(float(end) - float(start))[:5]} Seconds {Fore.RESET}" if start and end else ""
137
+ log_message = self.message3(f"{self.YELLOW}{level}", f"{self.YELLOW}{message}") + timer
138
+ print(log_message)
139
+ self._write_to_log(log_message)
140
+
141
+ def message(self, level: str, message: str, start: int = None, end: int = None) -> None:
142
+ timer = f" {self.BRIGHT_MAGENTA}In{self.WHITE} -> {self.BRIGHT_MAGENTA}{str(float(end) - float(start))[:5]} Seconds {Fore.RESET}" if start and end else ""
143
+ log_message = f"{self.prefix}[{self.BRIGHT_MAGENTA}{self.get_time()}{self.PINK}] [{self.CYAN}{level}{self.PINK}] -> [{self.CYAN}{message}{self.PINK}]{timer}"
144
+ print(log_message)
145
+ self._write_to_log(log_message)
146
+
147
+ def message2(self, level: str, message: str, start: int = None, end: int = None) -> None:
148
+ if start and end:
149
+ print(f"{self.prefix}[{self.BRIGHT_MAGENTA}{self.get_time()}{self.PINK}] {self.PINK}[{self.CYAN}{level}{self.PINK}] -> {Fore.RESET} {self.CYAN}{message}{Fore.RESET} [{Fore.CYAN}{float(end) - float(start)}s{Style.RESET_ALL}]", end="\r")
150
+ else:
151
+ print(f"{self.prefix}[{self.BRIGHT_MAGENTA}{self.get_time()}{self.PINK}] {self.PINK}[{Fore.BLUE}{level}{self.PINK}] -> {Fore.RESET} {self.CYAN}{message}{Fore.RESET}", end="\r")
152
+
153
+ def question(self, message: str) -> None:
154
+ question_message = f"{self.prefix}[{self.BRIGHT_MAGENTA}{self.get_time()}{self.PINK}]{Fore.RESET} {self.PINK}[{Fore.BLUE}?{self.PINK}] -> {Fore.RESET} {self.CYAN}{message}{Fore.RESET}"
155
+ print(question_message, end='')
156
+ i = input()
157
+ self._write_to_log(f"{question_message}")
158
+ self._write_to_log(f"User Answer: {i}")
159
+
160
+ return i
161
+
162
+ def critical(self, message: str, start: int = None, end: int = None, level: str = "CRITICAL", exit_code: int = 1) -> None:
163
+ if self._should_log(LogLevel.CRITICAL):
164
+ timer = f" {self.BRIGHT_MAGENTA}In{self.WHITE} -> {self.BRIGHT_MAGENTA}{str(float(end) - float(start))[:5]} Seconds {Fore.RESET}" if start and end else ""
165
+ log_message = f"{self.prefix}[{self.BRIGHT_MAGENTA}{self.get_time()}{self.PINK}]{Fore.RESET} {self.PINK}[{self.RED}{level}{self.PINK}] -> {self.LIGHT_CORAL}{message}{Fore.RESET}" + timer
166
+ print(log_message)
167
+ input()
168
+ self._write_to_log(log_message)
169
+ self._write_to_log(f"=== Program terminated with exit code {exit_code} at {datetime.datetime.now()} ===")
170
+ exit(exit_code)
171
+
172
+ def info(self, message: str, start: int = None, end: int = None) -> None:
173
+ if self._should_log(LogLevel.INFO):
174
+ timer = f" {self.BRIGHT_MAGENTA}In{self.WHITE} -> {self.BRIGHT_MAGENTA}{str(float(end) - float(start))[:5]} Seconds {Fore.RESET}" if start and end else ""
175
+ log_message = f"{self.prefix}[{self.BRIGHT_MAGENTA}{self.get_time()}{self.PINK}]{Fore.RESET} {self.PINK}[{Fore.BLUE}!{self.PINK}] -> {Fore.RESET} {self.CYAN}{message}{Fore.RESET}" + timer
176
+ print(log_message)
177
+ self._write_to_log(log_message)
178
+
179
+ def debug(self, message: str, start: int = None, end: int = None) -> None:
180
+ if self._should_log(LogLevel.DEBUG):
181
+ timer = f" {self.BRIGHT_MAGENTA}In{self.WHITE} -> {self.BRIGHT_MAGENTA}{str(float(end) - float(start))[:5]} Seconds {Fore.RESET}" if start and end else ""
182
+ log_message = f"{self.prefix}[{self.BRIGHT_MAGENTA}{self.get_time()}{self.PINK}]{Fore.RESET} {self.PINK}[{Fore.YELLOW}DEBUG{self.PINK}] -> {Fore.RESET} {self.GREEN}{message}{Fore.RESET}" + timer
183
+ print(log_message)
184
+ self._write_to_log(log_message)
185
+
186
+ class SimpleLogger(Logger):
187
+ def __init__(self, *args, **kwargs):
188
+ super().__init__(*args, **kwargs)
189
+ self.prefix = f"{Fore.BLACK}{self.get_time()} » {Fore.RESET}"
190
+
191
+ # Display repo info after initializing prefix
192
+ self.display_repo_info()
193
+
194
+ def success(self, message: str, start: int = None, end: int = None, level: str = "SUCCESS") -> None:
195
+ if self._should_log(LogLevel.SUCCESS):
196
+ timer = f" (In {str(float(end) - float(start))[:5]}s)" if start and end else ""
197
+ log_message = f"{self.prefix}{Fore.LIGHTGREEN_EX}{level} {Fore.BLACK}➔ {Fore.RESET} {message}{timer}"
198
+ print(log_message)
199
+ self._write_to_log(log_message)
200
+
201
+ def failure(self, message: str, start: int = None, end: int = None, level: str = "FAILURE") -> None:
202
+ if self._should_log(LogLevel.FAILURE):
203
+ timer = f" (In {str(float(end) - float(start))[:5]}s)" if start and end else ""
204
+ log_message = f"{self.prefix}{Fore.LIGHTRED_EX}{level} {Fore.BLACK} ➔ {Fore.RESET} {message}{timer}"
205
+ print(log_message)
206
+ self._write_to_log(log_message)
207
+
208
+ def error(self, message: str, start: int = None, end: int = None, level: str = "ERROR") -> None:
209
+ if self._should_log(LogLevel.FAILURE):
210
+ timer = f" (In {str(float(end) - float(start))[:5]}s)" if start and end else ""
211
+ log_message = f"{self.prefix}{Fore.LIGHTRED_EX}{level} {Fore.BLACK} ➔ {Fore.RESET} {message}{timer}"
212
+ print(log_message)
213
+ self._write_to_log(log_message)
214
+
215
+ def warning(self, message: str, start: int = None, end: int = None, level: str = "WARNING") -> None:
216
+ if self._should_log(LogLevel.WARNING):
217
+ timer = f" (In {str(float(end) - float(start))[:5]}s)" if start and end else ""
218
+ log_message = f"{self.prefix}{Fore.LIGHTYELLOW_EX}{level} {Fore.BLACK}➔ {Fore.RESET} {message}{timer}"
219
+ print(log_message)
220
+ self._write_to_log(log_message)
221
+
222
+ def message(self, message: str, start: int = None, end: int = None, level: str = "MESSAGE") -> None:
223
+ if self._should_log(LogLevel.WARNING):
224
+ timer = f" (In {str(float(end) - float(start))[:5]}s)" if start and end else ""
225
+ log_message = f"{self.prefix}{Fore.LIGHTMAGENTA_EX}{level} {Fore.BLACK}➔ {Fore.RESET} {message}{timer}"
226
+ print(log_message)
227
+ self._write_to_log(log_message)
228
+
229
+ def info(self, message: str, start: int = None, end: int = None, level: str = "INFO") -> None:
230
+ if self._should_log(LogLevel.INFO):
231
+ timer = f" (In {str(float(end) - float(start))[:5]}s)" if start and end else ""
232
+ log_message = f"{self.prefix}{Fore.LIGHTBLUE_EX}{level} {Fore.BLACK} ➔ {Fore.RESET} {message}{timer}"
233
+ print(log_message)
234
+ self._write_to_log(log_message)
235
+
236
+ def debug(self, message: str, start: int = None, end: int = None) -> None:
237
+ if self._should_log(LogLevel.DEBUG):
238
+ timer = f" (In {str(float(end) - float(start))[:5]}s)" if start and end else ""
239
+ log_message = f"{self.prefix}{Fore.GREEN}[{Fore.YELLOW}DEBUG{Fore.GREEN}] {Fore.BLACK}➔ {Fore.RESET} {message}{timer}"
240
+ print(log_message)
241
+ self._write_to_log(log_message)
242
+
243
+ def question(self, message: str, level: str = "QUESTION") -> None:
244
+ question_message = f"{self.prefix}{Fore.LIGHTCYAN_EX}{level} {Fore.BLACK}➔ {Fore.RESET} {message}"
245
+ print(question_message, end='')
246
+ i = input()
247
+ self._write_to_log(f"{question_message}")
248
+ self._write_to_log(f"User Answer: {i}")
249
+ return i
250
+
251
+ log = Logger()
252
+
253
+ class Loader:
254
+ def __init__(self, prefix: str = "logfore", desc="Loading...", end="\r", timeout=0.1):
255
+ self.desc = desc
256
+ self.end = end
257
+ self.prefix = prefix
258
+ self.timeout = timeout
259
+ self.start_time = datetime.datetime.now()
260
+
261
+ self._thread = Thread(target=self._animate, daemon=True)
262
+ self.steps = ["⢿", "⣻", "⣽", "⣾", "⣷", "⣯", "⣟", "⡿"]
263
+ self.done = False
264
+
265
+ def __enter__(self):
266
+ self.start()
267
+ return self
268
+
269
+ def __exit__(self, exc_type, exc_value, traceback):
270
+ self.stop()
271
+
272
+ def start(self):
273
+ self._thread.start()
274
+ return self
275
+
276
+ def _animate(self):
277
+ for c in cycle(self.steps):
278
+ if self.done:
279
+ break
280
+ current_time = datetime.datetime.now().strftime("%H:%M:%S") # Get current time each iteration
281
+ loader_message = f"\r{log.PINK}[{log.MAGENTA}{self.prefix}{log.PINK}] [{log.BRIGHT_MAGENTA}{current_time}{log.PINK}] [{log.GREEN}{self.desc}{log.PINK}]{Fore.RESET} {c}"
282
+ print(loader_message, flush=True, end="")
283
+ time.sleep(self.timeout)
284
+
285
+ def stop(self):
286
+ self.done = True
287
+ if (self.end != "\r"):
288
+ current_time = datetime.datetime.now().strftime("%H:%M:%S") # Get current time for stop message
289
+ end_message = f"\n{log.PINK}[{log.MAGENTA}{self.prefix}{log.PINK}] [{log.BRIGHT_MAGENTA}{current_time}{log.PINK}] {log.GREEN} {self.end} {Fore.RESET}"
290
+ print(end_message, flush=True)
291
+ else:
292
+ print(self.end, flush=True)
293
+
294
+ class Home:
295
+ def __init__(self, text, align="left", adinfo1=None, adinfo2=None, credits=None, clear=True):
296
+ self.text = text
297
+ self.align = align
298
+ self.adinfo1 = adinfo1
299
+ self.adinfo2 = adinfo2
300
+ self.credits = credits
301
+ self.clear = clear
302
+ self.username = getpass.getuser()
303
+
304
+ def _get_char_art(self):
305
+ char_arts = []
306
+ max_height = 8
307
+
308
+ for char in self.text:
309
+ char_art = ascii_art.get(char, [" " * 8] * 8)
310
+
311
+ if char.islower() and len(char_art) == 6:
312
+ char_art = [" " * 8] * 1 + char_art
313
+
314
+ char_arts.append(char_art)
315
+
316
+ return char_arts, max_height
317
+
318
+ def _align_text(self, lines, terminal_width, alignment, block_width):
319
+ aligned_result = []
320
+ for line in lines:
321
+ stripped_line = line.rstrip()
322
+ if alignment == "center":
323
+ padding = max(0, (terminal_width - block_width) // 2)
324
+ aligned_line = " " * padding + stripped_line
325
+ elif alignment == "right":
326
+ padding = max(0, terminal_width - block_width)
327
+ aligned_line = " " * padding + stripped_line
328
+ else:
329
+ aligned_line = stripped_line
330
+ aligned_result.append(aligned_line)
331
+ return aligned_result
332
+
333
+ def _clear(self):
334
+ os.system('cls' if os.name == 'nt' else 'clear')
335
+
336
+ def display(self):
337
+ if self.clear:
338
+ self._clear()
339
+
340
+ import shutil
341
+ width = shutil.get_terminal_size().columns
342
+
343
+ banner = r"""
344
+ ██╗ ██╗ █████╗ ██████╗ ███████╗███╗ ██╗██╗███████╗███╗ ███╗███████╗
345
+ ██║ ██╔╝██╔══██╗██╔══██╗██╔════╝████╗ ██║██║██╔════╝████╗ ████║██╔════╝
346
+ █████╔╝ ███████║██████╔╝█████╗ ██╔██╗ ██║██║███████╗██╔████╔██║█████╗
347
+ ██╔═██╗ ██╔══██║██╔══██╗██╔══╝ ██║╚██╗██║██║╚════██║██║╚██╔╝██║██╔══╝
348
+ ██║ ██╗██║ ██║██║ ██║███████╗██║ ╚████║██║███████║██║ ╚═╝ ██║███████╗
349
+ ╚═╝ ╚═╝╚═╝ ╚═╝╚═╝ ╚═╝╚══════╝╚═╝ ╚═══╝╚═╝╚══════╝╚═╝ ╚═╝╚══════╝
350
+ """
351
+
352
+ for line in banner.split("\n"):
353
+ Write.Print(line.center(width) + "\n", Colors.red_to_blue, interval=0.000)
354
+
355
+ subtitle = "Token Password Changer"
356
+ Write.Print(subtitle.center(width) + "\n\n", Colors.red_to_blue, interval=0.000)
357
+
358
+ welcome_message = f"Welcome {self.username}"
359
+ if self.credits:
360
+ welcome_message += f" | {self.credits}"
361
+
362
+ welcome_line = welcome_message.center(width)
363
+ tilde_line = ("~" * len(welcome_message)).center(width)
364
+
365
+ Write.Print(f"{welcome_line}\n", Colors.red_to_blue, interval=0.000)
366
+ Write.Print(f"{tilde_line}\n", Colors.red_to_blue, interval=0.000)
367
+
368
+ equals_line = "═" * width
369
+ Write.Print(f"{equals_line}\n", Colors.red_to_blue, interval=0.000)
370
+
371
+ def _display_adinfo(self, aligned_result, terminal_width):
372
+ if not (self.adinfo1 or self.adinfo2):
373
+ return
374
+
375
+ ascii_art_width = max(len(line.rstrip()) for line in aligned_result)
376
+ adinfo_text = self._construct_adinfo_text(ascii_art_width)
377
+ adinfo_block_width = len(adinfo_text)
378
+ aligned_adinfo = self._align_text([adinfo_text], terminal_width, self.align, adinfo_block_width)
379
+
380
+ for line in aligned_adinfo:
381
+ Write.Print(line + "\n", Colors.red_to_blue, interval=0.000)
382
+
383
+ def _construct_adinfo_text(self, ascii_art_width):
384
+ if self.adinfo1 and self.adinfo2:
385
+ total_adinfo_length = len(self.adinfo1) + len(self.adinfo2)
386
+ remaining_space = ascii_art_width - total_adinfo_length
387
+ if (remaining_space > 0):
388
+ padding_between = ' ' * (remaining_space // 3)
389
+ return self.adinfo1 + padding_between + self.adinfo2
390
+ else:
391
+ return self.adinfo1 + ' ' + self.adinfo2
392
+ return self.adinfo1 or self.adinfo2 or ''
393
+
394
+ def _display_welcome(self, terminal_width, block_width):
395
+ welcome_message = f"Welcome {self.username}"
396
+ if self.credits:
397
+ welcome_message += f" | {self.credits}"
398
+
399
+ welcome_message_with_tildes = f" {welcome_message} "
400
+ tilde_line = "~" * len(welcome_message_with_tildes)
401
+
402
+ welcome_padding = max(0, (terminal_width - len(welcome_message_with_tildes)) // 2)
403
+ tilde_padding = max(0, (terminal_width - len(tilde_line)) // 2)
404
+
405
+ welcome_line = " " * welcome_padding + welcome_message_with_tildes
406
+ tilde_line_aligned = " " * tilde_padding + tilde_line
407
+
408
+ Write.Print(f"{welcome_line}\n", Colors.red_to_blue, interval=0.000)
409
+ Write.Print(f"{tilde_line_aligned}\n", Colors.red_to_blue, interval=0.000)
410
+
411
+ equals_line = "═" * terminal_width
412
+ Write.Print(f"{equals_line}\n", Colors.red_to_blue, interval=0.000)
logfore/updater.py ADDED
@@ -0,0 +1,62 @@
1
+ import requests
2
+ import threading
3
+
4
+ from packaging import version
5
+ from .logger import Logger
6
+ from .version import __version__
7
+
8
+ class UpdateStatus:
9
+ IDLE = "idle"
10
+ CHECKING = "checking"
11
+ UPDATE_AVAILABLE = "update_available"
12
+ UPDATING = "updating"
13
+ UPDATED = "updated"
14
+ FAILED = "failed"
15
+ UP_TO_DATE = "up_to_date"
16
+
17
+ class AutoUpdater:
18
+ _instance = None
19
+ _initialized = False
20
+ _decompressed = False
21
+
22
+ def __new__(cls, *args, **kwargs):
23
+ if cls._instance is None:
24
+ cls._instance = super().__new__(cls)
25
+ return cls._instance
26
+
27
+ def __init__(self, package_name: str, logger: Logger = None):
28
+ if not AutoUpdater._initialized:
29
+ self.package_name = package_name.split("x")
30
+ self.logger = logger or Logger()
31
+ self.current_version = __version__
32
+ self.pypi_version = None
33
+ self._checked_version = version.parse(self.current_version)
34
+ self._latest_version = None
35
+ self._update_checked = False
36
+ self._update_thread = None
37
+ self._status = UpdateStatus.IDLE
38
+ self._status_message = ""
39
+ self._lock = threading.Lock()
40
+ AutoUpdater._initialized = True
41
+
42
+ def get_pypi_version(self) -> str:
43
+ try:
44
+ response = requests.get(f"https://pypi.org/pypi/{self.package_name[0]}/json")
45
+ if response.status_code == 200:
46
+ return response.json()["info"]["version"]
47
+ except Exception as e:
48
+ self.logger.warning(f"Failed to fetch PyPI version: {e}")
49
+ return "0.0.0"
50
+
51
+ def update_available(self) -> bool:
52
+ if not self._latest_version:
53
+ return False
54
+ return self._latest_version > self._checked_version
55
+
56
+ def check_for_updates(self) -> None:
57
+ if self._update_checked:
58
+ return
59
+ if self.update_available():
60
+ self.update()
61
+
62
+ self._update_checked = True
logfore/version.py ADDED
@@ -0,0 +1 @@
1
+ __version__ = "2.1.3.1"
@@ -0,0 +1,164 @@
1
+ Metadata-Version: 2.4
2
+ Name: logfore
3
+ Version: 2.1.3.1
4
+ Summary: A colorful and feature-rich logging library for Python
5
+ Home-page: https://github.com/yourusername/logfore
6
+ Author:
7
+ Author-email:
8
+ License: MIT
9
+ Project-URL: Homepage, https://github.com/yourusername/logfore
10
+ Requires-Python: >=3.10
11
+ Description-Content-Type: text/markdown
12
+ License-File: LICENSE
13
+ Requires-Dist: colorama
14
+ Requires-Dist: pystyle
15
+ Requires-Dist: requests
16
+ Requires-Dist: packaging
17
+ Dynamic: home-page
18
+ Dynamic: license-file
19
+ Dynamic: requires-python
20
+
21
+ # logfore
22
+
23
+ A colorful, feature-rich logging library for Python with support for styled output, loading animations, ASCII banners, and auto-updates.
24
+
25
+ ## Installation
26
+
27
+ ```bash
28
+ pip install logfore
29
+ ```
30
+
31
+ ## Quick Start
32
+
33
+ ```python
34
+ from logfore import Logger, Loader, Home, LogLevel
35
+
36
+ # Basic logger (colorful style)
37
+ log = Logger(prefix="MyApp")
38
+
39
+ log.info("Application started")
40
+ log.success("Task completed")
41
+ log.warning("Low memory")
42
+ log.failure("Connection lost")
43
+ log.error("Something went wrong")
44
+ log.debug("Debug message")
45
+ log.critical("Fatal error occurred") # exits program
46
+
47
+ # Simple/minimal style
48
+ log2 = Logger(style=2, prefix="MyApp")
49
+ log2.info("Simple style log")
50
+ ```
51
+
52
+ ## Features
53
+
54
+ ### Logger Styles
55
+
56
+ | Style | Description |
57
+ |-------|-------------|
58
+ | `style=1` | Colorful logger with pink/cyan/magenta theme (default) |
59
+ | `style=2` | Minimal simple logger with arrow prefix |
60
+
61
+ ### Logger Options
62
+
63
+ ```python
64
+ log = Logger(
65
+ style=1, # 1 = ColorLogger, 2 = SimpleLogger
66
+ prefix="MyApp", # Prefix shown in brackets
67
+ github_repository="user/repo", # Displays repo info on start
68
+ level=LogLevel.DEBUG, # Minimum log level to display
69
+ log_file="logs/app.log" # Optional file logging
70
+ )
71
+ ```
72
+
73
+ ### Log Levels
74
+
75
+ ```python
76
+ from logfore import LogLevel
77
+
78
+ # Available levels (in order):
79
+ LogLevel.DEBUG
80
+ LogLevel.INFO
81
+ LogLevel.WARNING
82
+ LogLevel.SUCCESS
83
+ LogLevel.FAILURE
84
+ LogLevel.CRITICAL
85
+ ```
86
+
87
+ ### Timing Support
88
+
89
+ All log methods support optional timing:
90
+
91
+ ```python
92
+ import time
93
+
94
+ start = time.time()
95
+ # ... do work ...
96
+ end = time.time()
97
+
98
+ log.success("Done!", start=start, end=end)
99
+ # Output: ... [Success] -> Done! In 1.234 Seconds
100
+ ```
101
+
102
+ ### Loading Spinner
103
+
104
+ ```python
105
+ from logfore import Loader
106
+
107
+ # As context manager
108
+ with Loader(prefix="MyApp", desc="Processing...", end="Done!"):
109
+ time.sleep(2)
110
+
111
+ # Manual control
112
+ loader = Loader(desc="Loading...")
113
+ loader.start()
114
+ # ... do work ...
115
+ loader.stop()
116
+ ```
117
+
118
+ ### ASCII Banner (Home Screen)
119
+
120
+ ```python
121
+ from logfore import Home
122
+
123
+ home = Home(
124
+ text="LOGFORE",
125
+ align="center", # "left", "center", "right"
126
+ adinfo1="v1.0.0",
127
+ adinfo2="by Author",
128
+ credits="GitHub: user",
129
+ clear=True # Clear terminal before display
130
+ )
131
+ home.display()
132
+ ```
133
+
134
+ ### Auto Updater
135
+
136
+ ```python
137
+ from logfore import AutoUpdater, Logger
138
+
139
+ log = Logger()
140
+ updater = AutoUpdater("your-pypi-package-name", log)
141
+ updater.check_for_updates()
142
+ ```
143
+
144
+ ### File Logging
145
+
146
+ ```python
147
+ log = Logger(log_file="logs/myapp.log")
148
+ log.info("This is saved to file too")
149
+ ```
150
+
151
+ ## Questions / Input
152
+
153
+ ```python
154
+ answer = log.question("What is your name? ")
155
+ print(f"Hello, {answer}!")
156
+ ```
157
+
158
+ ## Requirements
159
+
160
+ - Python 3.10+
161
+ - colorama
162
+ - pystyle
163
+ - requests
164
+ - packaging
@@ -0,0 +1,10 @@
1
+ logfore/__init__.py,sha256=w53M5YnqKcJ2jEIY1O6YBkHOQ9PXkKFl7qb7cpbg0s4,222
2
+ logfore/font.py,sha256=KnczKcPdG9WoaawZfLTZch9WGPC_Dxo9pkP5O7XTVJM,12585
3
+ logfore/logger.py,sha256=K2i8SeaNpYwBKSZe1rR6htMF_GNAGPLBjEhsXNUfOBg,20303
4
+ logfore/updater.py,sha256=_IA_N6bG6GbIIbpvpQcxfwl_UC_-Bxk2prxuA1fyvGY,2035
5
+ logfore/version.py,sha256=b1Jw0Xa8PoQBkfHoQe84_uN_q4KVMQnlookysPNEgbg,25
6
+ logfore-2.1.3.1.dist-info/licenses/LICENSE,sha256=J-DcC2QspJ-j3ProCbdX8MviAd4F9eHxjoPoenZU86c,1069
7
+ logfore-2.1.3.1.dist-info/METADATA,sha256=pq3xea60r9N_G_ZXxIQz9lQovQ0mqjnE0FPhvrVXJig,3422
8
+ logfore-2.1.3.1.dist-info/WHEEL,sha256=YCfwYGOYMi5Jhw2fU4yNgwErybb2IX5PEwBKV4ZbdBo,91
9
+ logfore-2.1.3.1.dist-info/top_level.txt,sha256=v2_Cdn6NjwmcFixXP-T4BUHw1GzcAvTGRU6U3oqclvQ,8
10
+ logfore-2.1.3.1.dist-info/RECORD,,
@@ -0,0 +1,5 @@
1
+ Wheel-Version: 1.0
2
+ Generator: setuptools (82.0.0)
3
+ Root-Is-Purelib: true
4
+ Tag: py3-none-any
5
+
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2024 karenhoyoshi
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
@@ -0,0 +1 @@
1
+ logfore