Categorygithub.com/securisec/go-debug
modulepackage
0.0.7
Repository: https://github.com/securisec/go-debug.git
Documentation: pkg.go.dev

# README

go-debug

go-debug is a similar library to npm debug package. This module was written mostly for personal consumption and does not offer anywhere near the amount of customization offered by the npm package.

go-debug uses the DEBUG envrionment variable to log data. This envar can contain multiple comma seperated values indicating different namespaces. If a * is used as the value of this envar, it will log all namespaces. If the envar does not have any value set, all logs will be ignored.

General rules to remember when setting the DEBUG environment:

  • Multiple namespaces can be specified with a ,
  • * Will log all
  • TAG Will log tag only
  • !TAG Will not be logged

Example: export DEBUG=APP

debugMe := gdebug.New()
debugMe("some log")
// This will not log

newDebug := debug.New(debug.Config{
    Namespace: "APP",
    Style: []color.Attribute{
        Yellow,
        Bold,
    },
})
newDebug("something", 1, true)
// This will log

Install

go get -u github.com/securisec/go-debug

# Functions

New create a new debug function Example: debugApp := gdebug.New() debugApp("Hello world").

# Constants

BgBlack background.
BgBlue background.
BgCyan background.
BgGreen background.
BgMagenta background.
BgRed background.
BgWhite background.
BgYellow background.
Black foreground.
BlinkRapid text.
BlinkSlow text.
Blue Blue foreground.
Bold text.
Cyan foreground.
Green Green foreground.
Italic text.
Magenta foreground.
Red foreground.
Underline text.
White foreground.
Yellow Yellow foreground.

# Variables

ConfigDefault default config.

# Structs

Config debug options.