Skip to content

Commit

Permalink
ref: change log format
Browse files Browse the repository at this point in the history
  • Loading branch information
kenriortega committed Nov 11, 2021
1 parent d9b34f0 commit 1139d73
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 6 deletions.
9 changes: 5 additions & 4 deletions cmd/cli/root.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ import (
handlers "github.com/kenriortega/ngonx/internal/mngt/handlers"
services "github.com/kenriortega/ngonx/internal/mngt/services"
"github.com/kenriortega/ngonx/pkg/config"
"github.com/kenriortega/ngonx/pkg/errors"
"github.com/kenriortega/ngonx/pkg/healthcheck"
"github.com/kenriortega/ngonx/pkg/httpsrv"
"github.com/kenriortega/ngonx/pkg/logger"
Expand Down Expand Up @@ -70,7 +71,7 @@ func initConfig() {
configFromYaml, errConfig = config.LoadConfig(cfgPath, cfgFile)

if errConfig != nil {
logger.LogError("Yaml file not found please run command setup " + errConfig.Error())
logger.LogError(errors.Errorf("ngonx: Yaml file not found please run command setup :%v", errConfig).Error())
}
go StartMngt(configFromYaml)

Expand All @@ -80,7 +81,7 @@ func StartMngt(config config.Config) {

stripped, err := fs.Sub(frontend, "ui")
if err != nil {
logger.LogError(err.Error())
logger.LogError(errors.Errorf("ngonx: :%v", err).Error())
}

frontendFS := http.FileServer(http.FS(stripped))
Expand Down Expand Up @@ -125,12 +126,12 @@ func StartMngt(config config.Config) {

endpoints, err := service.ListEndpoints()
if err != nil {
logger.LogError(err.Error())
logger.LogError(errors.Errorf("ngonx: :%v", err).Error())
}
for _, it := range endpoints {
u, err := url.Parse(it.PathUrl)
if err != nil {
logger.LogError(err.Error())
logger.LogError(errors.Errorf("ngonx: :%v", err).Error())
}
status := healthcheck.IsBackendAlive(u)
if status {
Expand Down
4 changes: 2 additions & 2 deletions pkg/errors/customsErrors.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ var (
ErrCreatingSettingFile = NewError("security: error on create setting file")
ErrWritingSettingFile = NewError("security: error on write setting file")
// loadbalancer
ErrIsBackendAlive = NewError("lb: Site unreachcable dial tcp")
ErrIsBackendAlive = NewError("ngonx healthcheck: Site unreachcable dial tcp")
// repositoryDB
ErrSavekeyUpdateTX = NewError("badgerdb: error executing TX to save apikey")
ErrSavekeyUpdate = NewError("badgerdb: error to save apikey")
Expand All @@ -19,7 +19,7 @@ var (
ErrGetkeyValue = NewError("baderdb: error executing get item value")
ErrGetkeyView = NewError("baderdb: error executing get view")
// lbHandler
ErrLBHttp = NewError("lbHandler: error service not availeble")
ErrLBHttp = NewError("lb: error service not availeble")
ErrBearerTokenFormat = NewError("proxyHandler: error Format is Authorization: Bearer [token]")
ErrTokenExpValidation = NewError("proxyHandler: error token expired")
ErrTokenHMACValidation = NewError("proxyHandler: error HMAC verification failed")
Expand Down

0 comments on commit 1139d73

Please sign in to comment.