debug

package
v1.0.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 21, 2024 License: Apache-2.0 Imports: 3 Imported by: 9

Documentation

Overview

Package debug is a library to display debug info that control by enviroment variable DEBUG

Example

package main
// import the package
import "github.com/alibabacloud-go/debug/debug"

// init a debug method
var d = debug.Init("sdk")

func main() {
	// try `go run demo.go`
	// and `DEBUG=sdk go run demo.go`
	d("this debug information just print when DEBUG environment variable was set")
}

When you run application with `DEBUG=sdk go run main.go`, it will display logs. Otherwise it do nothing

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Debug

type Debug func(format string, v ...interface{})

Debug is a method that display logs, it is useful for developer to trace program running details when troubleshooting

func Init

func Init(flag string) Debug

Init returns a debug method that based the enviroment variable DEBUG value

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL