debuglog

package module
v0.0.0-...-e267b4b Latest Latest
Warning

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

Go to latest
Published: Jun 24, 2021 License: Apache-2.0 Imports: 8 Imported by: 0

README

debuglog

Easy log variable for debugging

Usage

go get -u github.com/chinaran/debuglog

Functions

debuglog.Val()

print a value

debuglog.SpewVal()

print a value using spew https://github.com/davecgh/go-spew

debuglog.ToJson()

print a value (json string)

debuglog.ToJsonPretty()

print a value (pretty json string)

Example

package main

import "github.com/chinaran/debuglog"

type TestJson struct {
	Id   int64
	Name string
}

func main() {
	intVal := 123
	debuglog.Val(intVal)
	debuglog.Val(intVal, "prefix1")
	debuglog.Val(intVal, "prefix1", "prefix2")

	testJson := TestJson{Id: 987, Name: "alan"}

	debuglog.SpewVal(testJson, "testJson Spew")
	// debuglog.OctUtf8Val(testJson, "testJson")

	debuglog.ToJson(testJson, "testJson")
	debuglog.ToJsonPretty(testJson, "testJson Pretty")
}

result:

result

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func OctUtf8Val

func OctUtf8Val(v interface{}, name ...string)

Spew 打印一个包含8进制utf-8字符串的值

func SpewVal

func SpewVal(v interface{}, name ...string)

Spew 打印一个值

func ToJson

func ToJson(v interface{}, name ...string)

转换成json后打印

func ToJsonPretty

func ToJsonPretty(v interface{}, name ...string)

转换成json后打印

func Val

func Val(v interface{}, name ...string)

打印一个值

Types

This section is empty.

Jump to

Keyboard shortcuts

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