From 4e10f416ff6d6422609222cfff35b79df61aa6e2 Mon Sep 17 00:00:00 2001 From: Artem Derevnjuk Date: Wed, 4 Oct 2023 11:21:37 +0400 Subject: [PATCH] refactor(repeater): improve error messages (#463) --- src/Repeater/ServerRepeaterLauncher.ts | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/Repeater/ServerRepeaterLauncher.ts b/src/Repeater/ServerRepeaterLauncher.ts index b357e533..a4df7ea2 100644 --- a/src/Repeater/ServerRepeaterLauncher.ts +++ b/src/Repeater/ServerRepeaterLauncher.ts @@ -14,6 +14,7 @@ import { Helpers, logger } from '../Utils'; import { CliInfo } from '../Config'; import { RepeaterCommandHub } from './RepeaterCommandHub'; import { delay, inject, injectable } from 'tsyringe'; +import chalk from 'chalk'; @injectable() export class ServerRepeaterLauncher implements RepeaterLauncher { @@ -123,7 +124,7 @@ export class ServerRepeaterLauncher implements RepeaterLauncher { ); }); this.repeaterServer.errorOccurred(({ message }) => { - logger.error(message); + logger.error(`%s: %s`, chalk.red('(!) CRITICAL'), message); }); this.repeaterServer.reconnectionFailed((payload) => this.reconnectionFailed(payload) @@ -139,7 +140,8 @@ export class ServerRepeaterLauncher implements RepeaterLauncher { ); this.repeaterServer.upgradeAvailable((payload) => logger.warn( - 'A new Repeater version (%s) is available, please update Bright CLI', + '%s: A new Repeater version (%s) is available, for update instruction visit https://docs.brightsec.com/docs/installation-options', + chalk.yellow('(!) IMPORTANT'), payload.version ) ); @@ -147,7 +149,7 @@ export class ServerRepeaterLauncher implements RepeaterLauncher { logger.warn('Failed to connect (attempt %d/%d)', attempt, maxAttempts) ); this.repeaterServer.reconnectionSucceeded(() => - logger.log('Repeater connected') + logger.log('The Repeater (%s) connected', this.info.version) ); }