mazey
    Preparing search index...

    Function genCustomConsole

    • Create a configurable wrapper around the global console.

      Usage:

      import { genCustomConsole } from "mazey";

      const cusConsole = genCustomConsole("[MazeyLog]");
      cusConsole.log("I am string.");
      cusConsole.info("I am boolean.", true);
      cusConsole.info("I am number.", 123, 456);
      cusConsole.info("I am object.", { a: 123, b: 456});

      Output:

      [MazeyLog] I am string.
      [MazeyLog] I am boolean. true
      [MazeyLog] I am number. 123 456
      [MazeyLog] I am object. {a: 123, b: 456}
      

      Parameters

      • prefix: string = ""

        The prefix string.

      • options: {
            enabled?: boolean;
            errorFn?: () => void;
            isClosed?: boolean;
            isStringifyObject?: boolean;
            locales?: string;
            logFn?: () => void;
            showDate?: boolean;
            showWrap?: boolean;
        } = ...

        The options object.

        • Optionalenabled?: boolean

          Whether logging is enabled.

        • OptionalerrorFn?: () => void

          The function with Error.

        • OptionalisClosed?: boolean

          Deprecated, Use "enabled" instead.

        • OptionalisStringifyObject?: boolean

          Whether to stringify the object.

        • Optionallocales?: string

          A locale string.

        • OptionallogFn?: () => void

          The function with Log.

        • OptionalshowDate?: boolean

          Whether to show the date.

        • OptionalshowWrap?: boolean

          Whether to show the wrap.

      Returns Console

      The custom console object.