@nevware21/ts-debug
    Preparing search index...

    Function createDbg

    • Create a new IDbg instance with no providers, name and the default level is eDbgLevel.All when no configuration is provided.

      Parameters

      • Optionalconfig: string | IDbgConfig

        Can be either a string or an IDbgConfig instance, when a string value this will be the name of the instance.

      Returns IDbg

      A new instance

      import { createDbg, eDbgLevel, createConsoleProvider } from "@nevware21/ts-debug";

      // Create a new IDbg instance with the defaule values
      let dbg = createDbg();

      dbg.log.debug("Debug Message"); // Nothing emitted to the provider(s)
      dbg.log.error("Error Message"); // "Error Message" emitted to the provider(s)

      // Create a named IDbg instance enabling all debug logging levels
      let dbgAll = createbg({
      name: "MyTest"
      });

      // The logging context sent to the providers will include the name `MyTest`
      dbgAll.log.debug("Debug Message"); // "Debug Message" emitted to the provider(s)
      dbgAll.log.error("Error Message"); // "Error Message" emitted to the provider(s)

      // If the console provider is added to the instance, then the name will be included
      // in the output.
      dbgAll.addProvider(createConsoleProvider());

      // The logging context sent to the providers will include the name `MyTest`
      // Nothing emitted to the console as the provide by default will only send Error and higher messages
      dbgAll.log.debug("Debug Message");

      // "[MyTest]: Error Message" emitted to the console(s)
      dbgAll.log.error("Error Message");