disclosure

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

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

Go to latest
Published: Sep 27, 2021 License: Unlicense Imports: 12 Imported by: 0

README

Disclosure

Make secret information known

Usage

Below is how you can use it

Monitor

Capture errors generated by your code.

package main

import (
	"gitlab.com/aredstarling/disclosure"
	"gitlab.com/aredstarling/golog"
)

func main() {
	logger := golog.CreateStdout()
	app, err := disclosure.CreateApplication("Our cool APP", logger)
	if err != nil {
		logger.FatalError("Bad app", err)
	}

	app.Monitor(func() {
		// Do something cool
	})
}

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Application

type Application struct {
	Logger golog.Logger
	Name   string
	// contains filtered or unexported fields
}

Application defines a way to seperate what we want dislosed.

func CreateApplication

func CreateApplication(name string, logger golog.Logger) (*Application, error)

CreateApplication to seperate what we want dislose

func (*Application) Close

func (a *Application) Close(c io.Closer)

Close by checking the error.

func (*Application) End

func (a *Application) End(e Ender)

End by checking the error.

func (*Application) FailOnError

func (a *Application) FailOnError(err error)

FailOnError panics if there is an error

func (*Application) Monitor

func (a *Application) Monitor(main func() error)

Monitor the application

func (*Application) Notify

func (a *Application) Notify(name string, err error)

Notify an error has occured

func (*Application) SignalTermination

func (a *Application) SignalTermination(main func()) chan os.Signal

SignalTermination handles SIGTERM

func (*Application) Stop

func (a *Application) Stop(s Stoper)

Stop by checking the error.

func (*Application) Trace

func (a *Application) Trace(name string, main func(tracePoint *TracePoint) error) error

Trace a specific name

type Ender

type Ender interface {
	End() error
}

Ender is the interface that wraps the basic End method.

The behavior of End after the first call is undefined. Specific implementations may document their own behavior.

type Stoper

type Stoper interface {
	Stop() error
}

Stoper is the interface that wraps the basic Stop method.

The behavior of Stop after the first call is undefined. Specific implementations may document their own behavior.

type TracePoint

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

TracePoint is used for finer control of tracing

func (*TracePoint) AddMetrics

func (t *TracePoint) AddMetrics(metrics map[string]interface{})

AddMetrics to the trace point.

func (*TracePoint) Trace

func (t *TracePoint) Trace(name string, main func())

Trace a specific name

Jump to

Keyboard shortcuts

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