dara-core 1.16.14__py3-none-any.whl → 1.16.15__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.
dara/core/logging.py CHANGED
@@ -254,13 +254,14 @@ class DaraDevFormatter(logging.Formatter):
254
254
  'INFO': (Back.GREEN, Fore.GREEN),
255
255
  'WARNING': (Back.YELLOW, Fore.YELLOW),
256
256
  }
257
+ default_color = (Back.GREEN, Fore.GREEN)
257
258
 
258
259
  def format(self, record: logging.LogRecord):
260
+ colors = self.level_to_color_map.get(record.levelname, self.default_color)
259
261
  if isinstance(record.msg, dict):
260
262
  payload = {**record.msg}
261
263
  fmt_time = self.formatTime(record, self.datefmt)
262
264
  spacer = ' ' * 4
263
- colors = self.level_to_color_map[record.levelname]
264
265
  base_msg = self.base_message_template % (
265
266
  fmt_time,
266
267
  colors[0],
@@ -303,7 +304,6 @@ class DaraDevFormatter(logging.Formatter):
303
304
  description = self.extra_template % (spacer, f'Description: {payload["description"]}')
304
305
  return base_msg + '\r\n' + file_details + description + content + '\r\n' + self.message_end
305
306
 
306
- colors = self.level_to_color_map[record.levelname]
307
307
  return self.base_message_template % (
308
308
  self.formatTime(record, self.datefmt),
309
309
  colors[0],