dbg

package
v0.0.0 Latest Latest
Warning

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

Go to latest
Published: Sep 23, 2018 License: Unlicense, Unlicense Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Append

func Append(key string, object Debugger) (out string)

Append an entry to the log

func Init

func Init()

Init is exposed here for testing purposes

Types

type Dbg

type Dbg struct {
	File    *os.File
	Counter int
	Last    int64
}

Dbg is a debug instance

var (
	// LogFileName is the location where the log is output for viewing
	LogFileName = "/tmp/duo.json"
	// D is the central repository for the debugger
	D Dbg
)

func (*Dbg) Close

func (r *Dbg) Close()

Close the json string. Should be run as part of a defer recover() closure in main

type Debugger

type Debugger interface {
	// Freeze prints the full content of the variable into JSON format
	Freeze() string
	// Thaw takes a description made by the above and fills a variable with it
	Thaw(string) interface{}
}

Debugger is an interface for keeping track of state changes for debugging

type Note

type Note struct {
	Value string
}

Note is a debug-only structure used for miscellaneous log notes

func NewNote

func NewNote(s string) *Note

NewNote creates a new note with a given string

func (*Note) Freeze

func (r *Note) Freeze() (R string)

Freeze renders the note into JSON

func (*Note) Thaw

func (r *Note) Thaw(string) (R interface{})

Thaw unmarshals the note from JSON

Jump to

Keyboard shortcuts

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