debugsrv

package
v2.1.0 Latest Latest
Warning

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

Go to latest
Published: Feb 7, 2021 License: BSD-3-Clause Imports: 8 Imported by: 0

README

Using debug server with custom setting

package main

import (
	"time"

	"github.com/deweppro/go-http/v2/servers/debugsrv"
	"github.com/deweppro/go-http/v2/servers/httpsrv"
	"github.com/deweppro/go-logger"
)

func main() {
	dbg := debugsrv.NewCustom(httpsrv.ConfigItem{Addr: "localhost:8090"}, logger.Default())

	if err := dbg.Up(); err != nil {
		panic(err)
	}

	<-time.After(time.Minute)

	if err := dbg.Down(); err != nil {
		panic(err)
	}
}

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	Debug httpsrv.ConfigItem `yaml:"debug" json:"debug"`
}

Config model

func (Config) MarshalEasyJSON

func (v Config) MarshalEasyJSON(w *jwriter.Writer)

MarshalEasyJSON supports easyjson.Marshaler interface

func (Config) MarshalJSON

func (v Config) MarshalJSON() ([]byte, error)

MarshalJSON supports json.Marshaler interface

func (*Config) UnmarshalEasyJSON

func (v *Config) UnmarshalEasyJSON(l *jlexer.Lexer)

UnmarshalEasyJSON supports easyjson.Unmarshaler interface

func (*Config) UnmarshalJSON

func (v *Config) UnmarshalJSON(data []byte) error

UnmarshalJSON supports json.Unmarshaler interface

type Debug

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

Debug ...

func New

func New(conf *Config, log logger.Logger) *Debug

New ...

func NewCustom

func NewCustom(conf httpsrv.ConfigItem, log logger.Logger) *Debug

NewCustom ...

func (*Debug) Down

func (d *Debug) Down() error

Down ...

func (*Debug) ServeHTTP

func (d *Debug) ServeHTTP(w http.ResponseWriter, r *http.Request)

ServeHTTP ...

func (*Debug) Up

func (d *Debug) Up() error

Up ...

Jump to

Keyboard shortcuts

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