Function createConsole

  • Creates a custom console object.

    Parameters

    • opts: {
          clearConsole?: (() => void);
          formatter?: ((args: unknown[]) => string);
          inspect?: ((args: unknown[]) => string);
          logger?: ((logLevel: string, args: unknown[], options: ConsolePrinterOptions) => void);
          printer: ((logLevel: string, args: unknown[], options: ConsolePrinterOptions) => void);
      }
      • OptionalclearConsole?: (() => void)

        function to clear the console, e.g. send the ASCII ctrl character

          • (): void
          • Returns void

      • Optionalformatter?: ((args: unknown[]) => string)

        format given values, either by using a format string as first param or otherwise display values in a well readable format, see https://console.spec.whatwg.org/#formatter

          • (args): string
          • Parameters

            • args: unknown[]

            Returns string

      • Optionalinspect?: ((args: unknown[]) => string)

        format js values to be well readable

          • (args): string
          • Parameters

            • args: unknown[]

            Returns string

      • Optionallogger?: ((logLevel: string, args: unknown[], options: ConsolePrinterOptions) => void)

        function to handle normal log messages, see https://console.spec.whatwg.org/#logger

          • (logLevel, args, options): void
          • Parameters

            Returns void

      • printer: ((logLevel: string, args: unknown[], options: ConsolePrinterOptions) => void)

        function to print messages to somewhere, see https://console.spec.whatwg.org/#printer

          • (logLevel, args, options): void
          • Parameters

            Returns void

    Returns typeof console