godbg

package module
v0.0.0-...-8318cca Latest Latest
Warning

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

Go to latest
Published: Nov 1, 2019 License: MIT Imports: 8 Imported by: 10

README

godbg

Easy debug printf, with indent depending on the call stack depth

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Err

func Err() io.Writer

Err returns a writer for error messages. By default, os.StdErr

func ErrString

func ErrString() string

ErrString returns the string for error messages for the global pdbg instance. It flushes the err buffer. If err is set to os.StdErr, returns an empty string

func NoOutput

func NoOutput() bool

NoOutput checks if there is any output recorded on Stdout or Stderr

func Out

func Out() io.Writer

Out returns a writer for normal messages. By default, os.StdOut

func OutString

func OutString() string

OutString returns the string for out messages for the global pdbg instance. It flushes the out buffer. If out is set to os.Stdout, returns an empty string

func Pdbgf

func Pdbgf(format string, args ...interface{}) string

Pdbgf uses global Pdbg variable for printing strings, with indent and function name

func Perrdbgf

func Perrdbgf(format string, args ...interface{}) string

Perrdbgf uses Stderr for printing strings, with indent and function name

func ResetIOs

func ResetIOs()

ResetIOs reset the out and err buffer of global pdbg instance

func SetBuffers

func SetBuffers(apdbg *Pdbg)

SetBuffers is an option for replacing stdout and stderr by bytes buffers (in a bufio.Writer). If apdbg is nil, set for the global pdbg instance

func ShouldEqualNL

func ShouldEqualNL(actual interface{}, expected ...interface{}) string

ShouldEqualNL is a custom goconvey assertion to ignore differences with func id and lines: `[globalPdbgExcludeTest:16] (func.019:167)` would be equal to [globalPdbgExcludeTest] (func) (see https://github.com/smartystreets/goconvey/wiki/Custom-Assertions)

Types

type Option

type Option func(*Pdbg)

Option set an option for a Pdbg http://dave.cheney.net/2014/10/17/functional-options-for-friendly-apis

func OptExcludes

func OptExcludes(excludes []string) Option

OptExcludes is an option to set excludes at the creation of a pdbg

func OptSkips

func OptSkips(skips []string) Option

OptSkips is an option to set excludes at the creation of a pdbg

type Pdbg

type Pdbg struct {
	// contains filtered or unexported fields
}

Pdbg allows to print debug message with indent and function name added

func NewPdbg

func NewPdbg(options ...Option) *Pdbg

NewPdbg creates a PDbg instance, with options

func (*Pdbg) Err

func (pdbg *Pdbg) Err() io.Writer

Err returns a writer for error messages for a given pdbg instance. By default, os.StdErr

func (*Pdbg) ErrString

func (pdbg *Pdbg) ErrString() string

ErrString returns the string for error messages for a given pdbg instance. It flushes the err buffer. If err is set to os.StdErr, returns an empty string

func (*Pdbg) NoOutput

func (pdbg *Pdbg) NoOutput() bool

NoOutput checks if there is any output recorded on Stdout or Stderr for a given pdbg instance.

func (*Pdbg) Out

func (pdbg *Pdbg) Out() io.Writer

Out returns a writer for normal messages for a given pdbg instance. By default, os.StdOut

func (*Pdbg) OutString

func (pdbg *Pdbg) OutString() string

OutString returns the string for out messages for a given pdbg instance. It flushes the out buffer. If out is set to os.Stdout, returns an empty string

func (*Pdbg) Pdbgf

func (pdbg *Pdbg) Pdbgf(format string, args ...interface{}) string

Pdbgf uses custom Pdbg variable for printing strings, with indent and function name

func (*Pdbg) ResetIOs

func (pdbg *Pdbg) ResetIOs()

ResetIOs reset the out and err buffer (unless they were the default stdout and stderr, in which case it does nothing)

func (*Pdbg) SetExcludes

func (pdbg *Pdbg) SetExcludes(excludes []string)

SetExcludes set excludes on a pdbg (nil for global pdbg)

func (*Pdbg) SetSkips

func (pdbg *Pdbg) SetSkips(skips []string)

SetSkips set skips on a pdbg (nil for global pdbg)

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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