console#debug TypeScript Examples

The following examples show how to use console#debug. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: network.ts    From arkb with MIT License 6 votes vote down vote up
command: CommandInterface = {
  name: 'network',
  aliases: ['n'],
  description: 'Get the current network info',
  options: [gatewayOption, timeoutOption, debugOption, helpOption, noColorsOption],
  execute: async (args: ArgumentsInterface): Promise<void> => {
    const { blockweave, colors } = args;

    try {
      const net = await blockweave.network.getInfo();
      console.log(parseColor(colors, `Network Details for ${blockweave.config.url}\n`, 'green'));
      Object.keys(net).forEach((key) => {
        const value = net[key];
        console.log(
          `${parseColor(colors, snakeCaseToTitleCase(key), 'yellow')}: ${parseColor(
            colors,
            isNaN(value) ? value : numbersForHumans(value),
            'cyan',
          )}`,
        );
      });
    } catch (err) {
      console.log(parseColor(colors, `Unable to reach ${blockweave.config.url} - ${err.message}`, 'red'));
      if (debug) console.log(err);
    }
  },
}