Skip to content

Commit

Permalink
docs
Browse files Browse the repository at this point in the history
  • Loading branch information
kubec committed May 27, 2021
1 parent 3abb996 commit a263449
Show file tree
Hide file tree
Showing 4 changed files with 58 additions and 5 deletions.
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
.idea
.vscode
*.log
chialoganalyzer
chia-log-analyzer
builds
19 changes: 18 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1 +1,18 @@
# Chia log analyzer
# Chia log analyzer
Simply realtime chia log analyzer

## Howto run
```
chia-log-analyzer.go-linux-amd64 --log=/path/to/debug.log
```
![Screenshot](./docs/screenshot-1.png)

## Features
- monitoring of chia debug.log file
- simply show basic info about farming
- automatic refresh every 5s

## Supported platforms
- Linux (tested on Ubuntu)
- RPI4 (use linux-arm builds)
- Windows10
29 changes: 29 additions & 0 deletions build.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
#!/usr/bin/env bash

package=chia-log-analyzer.go
#package=$1
#if [[ -z "$package" ]]; then
# echo "usage: $0 <package-name>"
# exit 1
#fi
package_split=(${package//\// })
package_name=${package_split[-1]}

platforms=("windows/amd64" "linux/amd64" "linux/arm" "darwin/amd64")

for platform in "${platforms[@]}"
do
platform_split=(${platform//\// })
GOOS=${platform_split[0]}
GOARCH=${platform_split[1]}
output_name=$package_name'-'$GOOS'-'$GOARCH
if [ $GOOS = "windows" ]; then
output_name+='.exe'
fi

env GOOS=$GOOS GOARCH=$GOARCH go build -o ./builds/$output_name $package
if [ $? -ne 0 ]; then
echo 'An error has occurred! Aborting the script execution...'
exit 1
fi
done
12 changes: 9 additions & 3 deletions chia-log-analyzer.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ package main

import (
"bufio"
"flag"
"fmt"
"log"
"os"
Expand All @@ -20,7 +21,7 @@ import (
"github.com/gizak/termui/v3/widgets"
)

const MYFILE = "debug.log"
var debuglogFile *string

var widgetLastTimestamp *widgets.Paragraph
var widgetLastPlots *widgets.Paragraph
Expand Down Expand Up @@ -76,6 +77,11 @@ var lastParsedLinesStack = stackStruct{count: 5}
var lastFarmStack = stackStructFloats{count: 29}

func main() {
debuglogFile = flag.String("log", "./debug.log", "path to debug.log")
flag.Parse()
if _, err := os.Stat(*debuglogFile); os.IsNotExist(err) {
fmt.Println("Please specify path to the log file, with parameter: log (--log=/path/to/debug.log)")
}

if err := ui.Init(); err != nil {
log.Fatalf("failed to initialize termui: %v", err)
Expand Down Expand Up @@ -142,10 +148,10 @@ func main() {
}

func loopReadFile() {
readFullFile(MYFILE)
readFullFile(*debuglogFile)
c := time.Tick(5 * time.Second)
for range c {
readFile(MYFILE)
readFile(*debuglogFile)
}
}

Expand Down

0 comments on commit a263449

Please sign in to comment.