mark-ross / debug-panel

This project was geared to give a cleaner and easier view of project pipeline flags. It is very minimal

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Debug Panel

Installation

You should be able to leverage the go tooling to just go get the package.

go get github.com/mark-ross/debug-panel

Usage

For each flag in your processing stream, create a new ProgressFlag object. From there you can assign the given statuses as the current status of the flag. Consider the example snippet below.

package main

import (
	"bufio"
	dbp "github.com/mark-ross/debug-panel"
	"os"
	"time"
)

func main() { 
    // create a new web server and start it in a goroutine
    dbp.NewWebServer("localhost", 9999).Start()

    // create a new progress flag, called cycle 1
    pf := dbp.NewProgressFlag("cycle1", dbp.NotStarted)
    
    // Start a goroutine with an infinite loop that just
    // assigns the various states after 2 second wait periods
    go func() {
        for {
            time.Sleep(2 * time.Second)
            pf.SetStatus(dbp.InProgress)

            time.Sleep(2 * time.Second)
            pf.SetStatus(dbp.Complete)

            time.Sleep(2 * time.Second)
            pf.SetStatus(dbp.Failure)
        }
    }()
    
    // Loop everything until a return is found
    input := bufio.NewScanner(os.Stdin)
    input.Scan()
}

NOTE: This project works by making 0.5 second interval fetch requests in javascript, where the filled templates are rendered as a table in HTML. THERE IS NO FILTERING OR VERIFICATION THAT THE CONTENTS ARE SAFE. USE AT YOUR OWN RISK.

About

This project was geared to give a cleaner and easier view of project pipeline flags. It is very minimal

License:MIT License


Languages

Language:Go 63.2%Language:CSS 20.4%Language:JavaScript 10.0%Language:HTML 6.3%