Remove default traceback logging to screen
This commit is contained in:
		| @@ -181,7 +181,7 @@ View full execution history: | |||||||
|        3   Run My Pipeline             09:23:55    09:24:03      8.082s   ❌ Error      RuntimeError('Random failure!') |        3   Run My Pipeline             09:23:55    09:24:03      8.082s   ❌ Error      RuntimeError('Random failure!') | ||||||
| ``` | ``` | ||||||
|  |  | ||||||
| Inspect traceback on failure: | Inspect result by index: | ||||||
|  |  | ||||||
| ```bash | ```bash | ||||||
| > history --result-index 0 | > history --result-index 0 | ||||||
| @@ -189,7 +189,7 @@ Action(name='step_1', action=flaky_step, args=(), kwargs={}, retry=True, rollbac | |||||||
| ok | ok | ||||||
| ``` | ``` | ||||||
|  |  | ||||||
| Print last result: | Print last result includes tracebacks: | ||||||
|  |  | ||||||
| ```bash | ```bash | ||||||
| > history --last-result | > history --last-result | ||||||
|   | |||||||
| @@ -883,7 +883,13 @@ class Falyx: | |||||||
|         self, selected_command: Command, error: Exception |         self, selected_command: Command, error: Exception | ||||||
|     ) -> None: |     ) -> None: | ||||||
|         """Handles errors that occur during the action of the selected command.""" |         """Handles errors that occur during the action of the selected command.""" | ||||||
|         logger.exception("Error executing '%s': %s", selected_command.description, error) |         logger.debug( | ||||||
|  |             "[%s] '%s' failed with error: %s", | ||||||
|  |             selected_command.key, | ||||||
|  |             selected_command.description, | ||||||
|  |             error, | ||||||
|  |             exc_info=True, | ||||||
|  |         ) | ||||||
|         self.console.print( |         self.console.print( | ||||||
|             f"[{OneColors.DARK_RED}]An error occurred while executing " |             f"[{OneColors.DARK_RED}]An error occurred while executing " | ||||||
|             f"{selected_command.description}:[/] {error}" |             f"{selected_command.description}:[/] {error}" | ||||||
| @@ -973,12 +979,7 @@ class Falyx: | |||||||
|         except Exception as error: |         except Exception as error: | ||||||
|             context.exception = error |             context.exception = error | ||||||
|             await self.hooks.trigger(HookType.ON_ERROR, context) |             await self.hooks.trigger(HookType.ON_ERROR, context) | ||||||
|             logger.error( |             await self._handle_action_error(selected_command, error) | ||||||
|                 "[run_key] Failed: %s — %s: %s", |  | ||||||
|                 selected_command.description, |  | ||||||
|                 type(error).__name__, |  | ||||||
|                 error, |  | ||||||
|             ) |  | ||||||
|             raise FalyxError( |             raise FalyxError( | ||||||
|                 f"[run_key] ❌ '{selected_command.description}' failed." |                 f"[run_key] ❌ '{selected_command.description}' failed." | ||||||
|             ) from error |             ) from error | ||||||
|   | |||||||
| @@ -149,14 +149,18 @@ class RetryHandler: | |||||||
|             sleep_delay = current_delay |             sleep_delay = current_delay | ||||||
|             if self.policy.jitter > 0: |             if self.policy.jitter > 0: | ||||||
|                 sleep_delay += random.uniform(-self.policy.jitter, self.policy.jitter) |                 sleep_delay += random.uniform(-self.policy.jitter, self.policy.jitter) | ||||||
|  |             logger.debug( | ||||||
|  |                 "[%s] Error: %s", | ||||||
|  |                 name, | ||||||
|  |                 last_error, | ||||||
|  |             ) | ||||||
|             logger.info( |             logger.info( | ||||||
|                 "[%s] Retrying (%s/%s) in %ss due to '%s'...", |                 "[%s] Retrying (%s/%s) in %ss due to '%s'...", | ||||||
|                 name, |                 name, | ||||||
|                 retries_done, |                 retries_done, | ||||||
|                 self.policy.max_retries, |                 self.policy.max_retries, | ||||||
|                 current_delay, |                 current_delay, | ||||||
|                 last_error, |                 last_error.__class__.__name__, | ||||||
|             ) |             ) | ||||||
|             await asyncio.sleep(current_delay) |             await asyncio.sleep(current_delay) | ||||||
|             try: |             try: | ||||||
| @@ -168,12 +172,17 @@ class RetryHandler: | |||||||
|             except Exception as retry_error: |             except Exception as retry_error: | ||||||
|                 last_error = retry_error |                 last_error = retry_error | ||||||
|                 current_delay *= self.policy.backoff |                 current_delay *= self.policy.backoff | ||||||
|  |                 logger.debug( | ||||||
|  |                     "[%s] Error: %s", | ||||||
|  |                     name, | ||||||
|  |                     retry_error, | ||||||
|  |                 ) | ||||||
|                 logger.warning( |                 logger.warning( | ||||||
|                     "[%s] Retry attempt %s/%s failed due to '%s'.", |                     "[%s] Retry attempt %s/%s failed due to '%s'.", | ||||||
|                     name, |                     name, | ||||||
|                     retries_done, |                     retries_done, | ||||||
|                     self.policy.max_retries, |                     self.policy.max_retries, | ||||||
|                     retry_error, |                     retry_error.__class__.__name__, | ||||||
|                 ) |                 ) | ||||||
|  |  | ||||||
|         context.exception = last_error |         context.exception = last_error | ||||||
|   | |||||||
| @@ -1 +1 @@ | |||||||
| __version__ = "0.1.66" | __version__ = "0.1.67" | ||||||
|   | |||||||
| @@ -1,6 +1,6 @@ | |||||||
| [tool.poetry] | [tool.poetry] | ||||||
| name = "falyx" | name = "falyx" | ||||||
| version = "0.1.66" | version = "0.1.67" | ||||||
| description = "Reliable and introspectable async CLI action framework." | description = "Reliable and introspectable async CLI action framework." | ||||||
| authors = ["Roland Thomas Jr <roland@rtj.dev>"] | authors = ["Roland Thomas Jr <roland@rtj.dev>"] | ||||||
| license = "MIT" | license = "MIT" | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user