hungerlib 2.3.dev0__py3-none-any.whl → 2.3.2.dev0__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.
hungerlib/logger.py CHANGED
@@ -8,37 +8,50 @@ time.tzset()
8
8
  import logging
9
9
  from pathlib import Path
10
10
  from datetime import datetime
11
- from hungerlib.config import *
12
11
 
13
12
 
14
13
  class HungerLogger:
15
14
  def __init__(
16
15
  self,
17
- loggerName,
18
- Config,
16
+ name,
17
+ server,
18
+ log_path,
19
+ log_destination_method='rcon',
20
+
21
+ # backspaces
19
22
  console_backspaces=0,
20
- logDir=None,
21
- server=None
23
+
24
+ # color mapping
25
+ file_color_map=None,
26
+ origin_color_map=ASCI_COLOR_MAP,
27
+ destination_color_map=ASCI_COLOR_MAP,
28
+ mc_color_map=MC_COLOR_MAP,
29
+
30
+ # prefixes
31
+ info_prefix='<white>[INFO]: ',
32
+ warn_prefix='<yellow>[WARN]: ',
33
+ error_prefix='<red>[ERROR]: '
22
34
  ):
23
- '''
24
- HungerLib's core logger
25
- Uses hungerlib.config for the Config system.
26
- '''
27
- self.loggerName = loggerName
28
- self.console_backspaces = '\b' * console_backspaces
29
- self.config = Config
35
+
36
+ self.name = name
30
37
  self.server = server
38
+ self.log_path = Path(f'{log_path}')
39
+ self.log_destionation_method = log_destination_method
40
+
41
+ self.console_backspaces = '\b' * console_backspaces
42
+
43
+ self.file_color_map = file_color_map
44
+ self.origin_color_map = origin_color_map
45
+ self.destination_color_map = destination_color_map
46
+ self.mc_color_map = mc_color_map
31
47
 
32
48
  self.prefixes = {
33
- "INFO": self.config.info_prefix,
34
- "WARN": self.config.warn_prefix,
35
- "ERROR": self.config.error_prefix
49
+ "INFO": self.info_prefix,
50
+ "WARN": self.warn_prefix,
51
+ "ERROR": self.error_prefix
36
52
  }
37
53
 
38
- self.log_destination_method = self.config.log_destination_method
39
-
40
- self.logDir = Path(logDir) if logDir else self.config.log_path
41
- self.logDir.mkdir(parents=True, exist_ok=True)
54
+ self.log_path.mkdir(parents=True, exist_ok=True)
42
55
  self.logger = logging.getLogger(loggerName)
43
56
  self.logger.setLevel(logging.DEBUG)
44
57
  self._initializeLogger()
@@ -65,9 +78,9 @@ class HungerLogger:
65
78
  return msg
66
79
 
67
80
  def _strip_colors(self, msg):
68
- if not self.config.file_color_map:
81
+ if not self.file_color_map:
69
82
  return msg
70
- for tag in self.config.file_color_map.keys():
83
+ for tag in self.file_color_map.keys():
71
84
  msg = msg.replace(tag, "")
72
85
  return msg
73
86
 
@@ -76,7 +89,7 @@ class HungerLogger:
76
89
  return
77
90
  if not hasattr(self.server, "_rcon_send"):
78
91
  return
79
- colored = self._apply_colors(msg, self.config.destination_color_map)
92
+ colored = self._apply_colors(msg, self.destination_color_map)
80
93
  if self.log_destination_method == 'rcon':
81
94
  self.server._rcon_send(f'logtellraw targetless \"{self.console_backspaces}{colored}\"')
82
95
  if self.log_destination_method == 'api':
@@ -91,7 +104,7 @@ class HungerLogger:
91
104
  self._destinationLog(full)
92
105
 
93
106
  if origin:
94
- colored = self._apply_colors(full + "<reset>", self.config.origin_color_map)
107
+ colored = self._apply_colors(full + "<reset>", self.origin_color_map)
95
108
  print(colored)
96
109
 
97
110
  if logs:
@@ -13,8 +13,8 @@ class MinecraftServer(GenericServer):
13
13
  panel,
14
14
  server_id,
15
15
  server_domain,
16
- server_port=25565,
17
- rcon_port=25575,
16
+ server_port,
17
+ rcon_port,
18
18
  rcon_password,
19
19
  tpsCommand='tt20 tps'
20
20
  ):
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: hungerlib
3
- Version: 2.3.dev0
3
+ Version: 2.3.2.dev0
4
4
  Summary: Powerful automation library for Pterodactyl.
5
5
  Author: iFamished
6
6
  License: MIT
@@ -1,7 +1,7 @@
1
1
  examples/Config.py,sha256=3sgbcahc0H6PWcFV9WQ0Ykc_QayYYWWAt2EAzchKPso,591
2
2
  hungerlib/__init__.py,sha256=owBo4YCdX29GFuAXX1-kzbYYbeqGLDgryBDKjvChsDQ,2254
3
3
  hungerlib/config.py,sha256=NWEj4C8SetNOwQMXKuuPRQ0OWEe8S4M3QWmEI5OW8R8,1026
4
- hungerlib/logger.py,sha256=ba7nbizkvcxQtiVtsICwicoTGjPp57Bs96BRArgrUHo,3681
4
+ hungerlib/logger.py,sha256=3XwkELezCf_lwXbMuaXxtXvsP_uuLOlbb9-EdUrA0L8,3956
5
5
  hungerlib/mchelpers.py,sha256=PuENTlzwPIBHymlmdynMK28CCy_l8x8yzJSzaguvMMM,3789
6
6
  hungerlib/panel.py,sha256=H0B6Ohshombsz2w3dFjJTbOfyRgcO-l-DARRfo0PVqQ,2178
7
7
  hungerlib/scheduler.py,sha256=40WcKF5Bc4Fmx-pviZuWA4GkNwrn8RP_TupA00SwD2A,890
@@ -16,9 +16,9 @@ hungerlib/api/filemanager.py,sha256=kB5NP3ELQzY1uW6JWVN1g4dekVl8Kk-u9cK7N5dsg3w,
16
16
  hungerlib/api/schedule.py,sha256=3gdl0jiIOScdVXWy4aOef-KIoKqUopbI8b1dPgXf5Vg,953
17
17
  hungerlib/api/startup.py,sha256=hKhBjpLMVYa3jjq6ahqm2N32B_fu-bZnOJTZ-P57v4M,434
18
18
  hungerlib/servers/generic.py,sha256=ROlzBRtQtL8ssMHOIAnFQmxevWG0x-bcYa75RuVl80Y,6552
19
- hungerlib/servers/minecraft.py,sha256=qgK9ccltKn2LOT_LljO1AYoTtFCcCUMfZEVem_m0a24,2567
20
- hungerlib-2.3.dev0.dist-info/licenses/LICENSE,sha256=OXLcl0T2SZ8Pmy2_dmlvKuetivmyPd5m1q-Gyd-zaYY,35149
21
- hungerlib-2.3.dev0.dist-info/METADATA,sha256=8_4N-d1sDyqgJjlZSq0PdMXDKXGyIZSqwzJ3cWak7P4,1514
22
- hungerlib-2.3.dev0.dist-info/WHEEL,sha256=aeYiig01lYGDzBgS8HxWXOg3uV61G9ijOsup-k9o1sk,91
23
- hungerlib-2.3.dev0.dist-info/top_level.txt,sha256=-oFAkOTGMfuvp0CBu82Ltag3EZwIqb663p_fymgcaqI,19
24
- hungerlib-2.3.dev0.dist-info/RECORD,,
19
+ hungerlib/servers/minecraft.py,sha256=FPIaaelHtMulucD42fxnx4pXfc_TN0RPY2onv--zMQ8,2555
20
+ hungerlib-2.3.2.dev0.dist-info/licenses/LICENSE,sha256=OXLcl0T2SZ8Pmy2_dmlvKuetivmyPd5m1q-Gyd-zaYY,35149
21
+ hungerlib-2.3.2.dev0.dist-info/METADATA,sha256=OLiR4IdGI3b6fGLczQYIcrbx0itdFQUnArKG3CQj-2k,1516
22
+ hungerlib-2.3.2.dev0.dist-info/WHEEL,sha256=aeYiig01lYGDzBgS8HxWXOg3uV61G9ijOsup-k9o1sk,91
23
+ hungerlib-2.3.2.dev0.dist-info/top_level.txt,sha256=-oFAkOTGMfuvp0CBu82Ltag3EZwIqb663p_fymgcaqI,19
24
+ hungerlib-2.3.2.dev0.dist-info/RECORD,,