Documentation ¶
Overview ¶
message from the author:
+--------------------------------------------------------------+ | * * * ░░░░░░░░░░░░░░░░░░░░ Hello ░░░░░░░░░░░░░░░░░░░░░░░░░░| +--------------------------------------------------------------+ | | | ++ ______________________________________ | | ++++ / \ | | ++++ | | | | ++++++++++ | Feel free to contribute to this | | | +++ | | project or contact me on | | | ++ | | manfred.life if you like this | | | + -== ==| | project! | | | ( <*> <*> | | | | | | /| :) | | | | _) / | | | | | +++ / \______________________________________/ | | \ =+ / | | \ + | | |\++++++ | | | ++++ ||// | | ___| |___ _||/__ __| | / --- \ \| ||| __ _ ___ __ __/ /| |/ | | \ \ / / ' \/ _ \/ // / / | || | | | | | /_/_/_/\___/\_,_/_/ | +--------------------------------------------------------------+
Index ¶
- func Debug()
- func Debugf(format string, args ...interface{})
- func JSON(input interface{}) string
- func JSONPB(input proto.Message) string
- func PrettyJSON(input interface{}) string
- func PrettyJSONPB(input proto.Message) string
- func Sdebug() string
- func Sdebugf(format string, args ...interface{}) string
- func SetDebugOutput(writer io.Writer)
- func Stacktrace() string
- func Uptime() time.Duration
- func YAML(input interface{}) string
Examples ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Debug ¶ added in v1.2.0
func Debug()
Example ¶
package main import ( "os" "moul.io/godev" ) func main() { godev.SetDebugOutput(os.Stdout) godev.Debug() godev.Debug() }
Output: [godev:debug] printfdebugging_test.go:12 [godev:debug] printfdebugging_test.go:13
func Debugf ¶ added in v1.2.0
func Debugf(format string, args ...interface{})
Example ¶
package main import ( "os" "moul.io/godev" ) func main() { godev.SetDebugOutput(os.Stdout) godev.Debugf("hello: %d", 42) godev.Debugf("world") }
Output: [godev:debug] printfdebugging_test.go:21 hello: 42 [godev:debug] printfdebugging_test.go:22 world
func JSON ¶
func JSON(input interface{}) string
Example ¶
package main import ( "fmt" "moul.io/godev" ) func main() { fmt.Println(godev.JSON([]string{"hello", "world"})) fmt.Println(godev.JSON(42)) fmt.Println(godev.JSON(nil)) }
Output: ["hello","world"] 42 null
func JSONPB ¶ added in v1.5.0
Example ¶
package main import ( "fmt" pb "github.com/gogo/protobuf/jsonpb/jsonpb_test_proto" "moul.io/godev" ) func main() { msg := pb.Mappy{Enumy: map[string]pb.Numeral{"XIV": pb.Numeral_ROMAN}} fmt.Println(godev.JSONPB(&msg)) }
Output: {"enumy":{"XIV":"ROMAN"}}
func PrettyJSON ¶
func PrettyJSON(input interface{}) string
Example ¶
package main import ( "fmt" "moul.io/godev" ) func main() { fmt.Println(godev.PrettyJSON([]string{"hello", "world"})) fmt.Println(godev.PrettyJSON(42)) fmt.Println(godev.PrettyJSON(nil)) }
Output: [ "hello", "world" ] 42 null
func PrettyJSONPB ¶ added in v1.5.0
Example ¶
package main import ( "fmt" pb "github.com/gogo/protobuf/jsonpb/jsonpb_test_proto" "moul.io/godev" ) func main() { msg := pb.Mappy{Enumy: map[string]pb.Numeral{"XIV": pb.Numeral_ROMAN}} fmt.Println(godev.PrettyJSONPB(&msg)) }
Output: { "enumy": { "XIV": "ROMAN" } }
func Sdebug ¶ added in v1.6.0
func Sdebug() string
Example ¶
package main import ( "fmt" "moul.io/godev" ) func main() { fmt.Println(godev.Sdebug()) fmt.Println(godev.Sdebug()) }
Output: [godev:debug] printfdebugging_test.go:29 [godev:debug] printfdebugging_test.go:30
func Sdebugf ¶ added in v1.6.0
Example ¶
package main import ( "fmt" "moul.io/godev" ) func main() { fmt.Println(godev.Sdebugf("hello: %d", 42)) fmt.Println(godev.Sdebugf("world")) }
Output: [godev:debug] printfdebugging_test.go:37 hello: 42 [godev:debug] printfdebugging_test.go:38 world
func SetDebugOutput ¶ added in v1.2.0
func Stacktrace ¶ added in v1.7.0
func Stacktrace() string
Example ¶
package main import ( "fmt" "moul.io/godev" ) func main() { fmt.Println(godev.Stacktrace()) }
Output:
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.