1
0
Fork 0
mirror of https://github.com/eosswedenorg/antelope-api-healthcheck synced 2026-06-18 05:00:03 +02:00

move src/helpers.go to src/utils/parse_log_formatter.go

This commit is contained in:
Henrik Hautakoski 2022-10-21 13:13:02 +02:00
parent 97d9e662ce
commit 818cf7e7e5
No known key found for this signature in database
GPG key ID: 608414D93E862CCD
4 changed files with 8 additions and 7 deletions

View file

@ -11,7 +11,7 @@ GOBUILDFLAGS = -v -ldflags='-v -s -w -X main.VersionString=$(PROGRAM_VERSION)'
DPKG_BUILDPACKAGE = dpkg-buildpackage
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
all: build

View file

@ -5,6 +5,7 @@ import (
"os"
"os/signal"
"syscall"
"github.com/eosswedenorg/eosio-api-healthcheck/src/utils"
log "github.com/inconshreveable/log15"
"github.com/eosswedenorg-go/pid"
"github.com/pborman/getopt/v2"
@ -148,7 +149,7 @@ func main() {
return;
}
logfmt = parseLogFormatter(*logFormatter)
logfmt = utils.ParseLogFormatter(*logFormatter)
// Open logfile.
if len(logFile) > 0 {

View file

@ -1,11 +1,11 @@
package main
package utils
import (
log "github.com/inconshreveable/log15"
)
func parseLogFormatter(name string) log.Format {
func ParseLogFormatter(name string) log.Format {
switch name {
case "logfmt" :

View file

@ -1,4 +1,4 @@
package main
package utils
import (
"reflect"
@ -7,7 +7,7 @@ import (
log "github.com/inconshreveable/log15"
)
func Test_parseLogFormatter(t *testing.T) {
func Test_ParseLogFormatter(t *testing.T) {
tests := []struct {
name string
arg string
@ -21,7 +21,7 @@ func Test_parseLogFormatter(t *testing.T) {
}
for _, tt := range tests {
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)
}
})