mirror of
https://github.com/aljazceru/Auto-GPT.git
synced 2025-12-17 14:04:27 +01:00
Merge pull request #1014 from drikusroor/fix-flake8-issues-pt-2
Fix flake8 issues pt. 2 (Add E231 & E302 flake8 rules)
This commit is contained in:
@@ -157,6 +157,7 @@ class TypingConsoleHandler(logging.StreamHandler):
|
||||
except Exception:
|
||||
self.handleError(record)
|
||||
|
||||
|
||||
class ConsoleHandler(logging.StreamHandler):
|
||||
def emit(self, record):
|
||||
msg = self.format(record)
|
||||
@@ -166,11 +167,11 @@ class ConsoleHandler(logging.StreamHandler):
|
||||
self.handleError(record)
|
||||
|
||||
|
||||
'''
|
||||
Allows to handle custom placeholders 'title_color' and 'message_no_color'.
|
||||
To use this formatter, make sure to pass 'color', 'title' as log extras.
|
||||
'''
|
||||
class AutoGptFormatter(logging.Formatter):
|
||||
"""
|
||||
Allows to handle custom placeholders 'title_color' and 'message_no_color'.
|
||||
To use this formatter, make sure to pass 'color', 'title' as log extras.
|
||||
"""
|
||||
def format(self, record: LogRecord) -> str:
|
||||
if (hasattr(record, 'color')):
|
||||
record.title_color = getattr(record, 'color') + getattr(record, 'title') + " " + Style.RESET_ALL
|
||||
|
||||
Reference in New Issue
Block a user