mirror of
https://github.com/eosswedenorg/antelope-api-healthcheck
synced 2026-07-02 11:43:42 +02:00
move src/helpers.go to src/utils/parse_log_formatter.go
This commit is contained in:
parent
97d9e662ce
commit
818cf7e7e5
4 changed files with 8 additions and 7 deletions
2
Makefile
2
Makefile
|
|
@ -11,7 +11,7 @@ GOBUILDFLAGS = -v -ldflags='-v -s -w -X main.VersionString=$(PROGRAM_VERSION)'
|
||||||
DPKG_BUILDPACKAGE = dpkg-buildpackage
|
DPKG_BUILDPACKAGE = dpkg-buildpackage
|
||||||
DPKG_BUILDPACKAGE_FLAGS = -b -uc
|
DPKG_BUILDPACKAGE_FLAGS = -b -uc
|
||||||
|
|
||||||
SOURCES=src/main.go src/server.go src/parse_request.go src/helpers.go
|
SOURCES=src/main.go src/server.go src/parse_request.go
|
||||||
|
|
||||||
.PHONY: all build/$(PROGRAM_NAME) clean package_debian
|
.PHONY: all build/$(PROGRAM_NAME) clean package_debian
|
||||||
all: build
|
all: build
|
||||||
|
|
|
||||||
|
|
@ -5,6 +5,7 @@ import (
|
||||||
"os"
|
"os"
|
||||||
"os/signal"
|
"os/signal"
|
||||||
"syscall"
|
"syscall"
|
||||||
|
"github.com/eosswedenorg/eosio-api-healthcheck/src/utils"
|
||||||
log "github.com/inconshreveable/log15"
|
log "github.com/inconshreveable/log15"
|
||||||
"github.com/eosswedenorg-go/pid"
|
"github.com/eosswedenorg-go/pid"
|
||||||
"github.com/pborman/getopt/v2"
|
"github.com/pborman/getopt/v2"
|
||||||
|
|
@ -148,7 +149,7 @@ func main() {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
logfmt = parseLogFormatter(*logFormatter)
|
logfmt = utils.ParseLogFormatter(*logFormatter)
|
||||||
|
|
||||||
// Open logfile.
|
// Open logfile.
|
||||||
if len(logFile) > 0 {
|
if len(logFile) > 0 {
|
||||||
|
|
|
||||||
|
|
@ -1,11 +1,11 @@
|
||||||
|
|
||||||
package main
|
package utils
|
||||||
|
|
||||||
import (
|
import (
|
||||||
log "github.com/inconshreveable/log15"
|
log "github.com/inconshreveable/log15"
|
||||||
)
|
)
|
||||||
|
|
||||||
func parseLogFormatter(name string) log.Format {
|
func ParseLogFormatter(name string) log.Format {
|
||||||
|
|
||||||
switch name {
|
switch name {
|
||||||
case "logfmt" :
|
case "logfmt" :
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
package main
|
package utils
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"reflect"
|
"reflect"
|
||||||
|
|
@ -7,7 +7,7 @@ import (
|
||||||
log "github.com/inconshreveable/log15"
|
log "github.com/inconshreveable/log15"
|
||||||
)
|
)
|
||||||
|
|
||||||
func Test_parseLogFormatter(t *testing.T) {
|
func Test_ParseLogFormatter(t *testing.T) {
|
||||||
tests := []struct {
|
tests := []struct {
|
||||||
name string
|
name string
|
||||||
arg string
|
arg string
|
||||||
|
|
@ -21,7 +21,7 @@ func Test_parseLogFormatter(t *testing.T) {
|
||||||
}
|
}
|
||||||
for _, tt := range tests {
|
for _, tt := range tests {
|
||||||
t.Run(tt.name, func(t *testing.T) {
|
t.Run(tt.name, func(t *testing.T) {
|
||||||
if got := parseLogFormatter(tt.arg); reflect.ValueOf(got).Pointer() != reflect.ValueOf(tt.want).Pointer() {
|
if got := ParseLogFormatter(tt.arg); reflect.ValueOf(got).Pointer() != reflect.ValueOf(tt.want).Pointer() {
|
||||||
t.Errorf("parseLogFormatter() = %v, want %v", got, tt.want)
|
t.Errorf("parseLogFormatter() = %v, want %v", got, tt.want)
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
Loading…
Add table
Add a link
Reference in a new issue