Spaces:
Runtime error
Runtime error
:boom: [Fix] Logger: Missing new-line char at end, and prettify indent implementation
Browse files- .gitignore +2 -1
- logger/logger.py +5 -7
.gitignore
CHANGED
@@ -1 +1,2 @@
|
|
1 |
-
__pycache__
|
|
|
|
1 |
+
__pycache__
|
2 |
+
tests
|
logger/logger.py
CHANGED
@@ -155,19 +155,17 @@ class Logger:
|
|
155 |
quotes = ["'", '"']
|
156 |
if msg_str[0] in quotes and msg_str[-1] in quotes:
|
157 |
msg_str = msg_str[1:-1]
|
158 |
-
msg_lines = msg_str.splitlines()
|
159 |
|
160 |
-
self.
|
161 |
-
|
162 |
-
indent_str = " " * self.log_indent
|
163 |
-
self.restore_indent()
|
164 |
|
165 |
-
level, color = self.LOG_METHODS[method]
|
166 |
-
indented_msg = "\n".join([f"{indent_str}{line}" for line in msg_lines])
|
167 |
if fill:
|
168 |
indented_msg = add_fillers(indented_msg, fill_side=fill_side)
|
|
|
169 |
handler = self.logger.handlers[0]
|
170 |
handler.terminator = end
|
|
|
|
|
171 |
getattr(self.logger, level)(colored(indented_msg, color), *args, **kwargs)
|
172 |
|
173 |
def bind_functions(self):
|
|
|
155 |
quotes = ["'", '"']
|
156 |
if msg_str[0] in quotes and msg_str[-1] in quotes:
|
157 |
msg_str = msg_str[1:-1]
|
|
|
158 |
|
159 |
+
indent_str = " " * (self.log_indent + indent)
|
160 |
+
indented_msg = "\n".join([indent_str + line for line in msg_str.split("\n")])
|
|
|
|
|
161 |
|
|
|
|
|
162 |
if fill:
|
163 |
indented_msg = add_fillers(indented_msg, fill_side=fill_side)
|
164 |
+
|
165 |
handler = self.logger.handlers[0]
|
166 |
handler.terminator = end
|
167 |
+
|
168 |
+
level, color = self.LOG_METHODS[method]
|
169 |
getattr(self.logger, level)(colored(indented_msg, color), *args, **kwargs)
|
170 |
|
171 |
def bind_functions(self):
|