Skip to content

Commit

Permalink
remove file logger from the gateway
Browse files Browse the repository at this point in the history
  • Loading branch information
zkokelj committed Aug 6, 2024
1 parent 86418f6 commit 08556e6
Show file tree
Hide file tree
Showing 3 changed files with 1 addition and 18 deletions.
14 changes: 0 additions & 14 deletions tools/walletextension/common/common.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,6 @@ package common
import (
"encoding/json"
"fmt"

Check failure on line 5 in tools/walletextension/common/common.go

View workflow job for this annotation

GitHub Actions / lint

File is not `goimports`-ed (goimports)
"os"

gethforklog "github.com/ten-protocol/go-ten/lib/gethfork/log"

gethrpc "github.com/ten-protocol/go-ten/lib/gethfork/rpc"

"github.com/ethereum/go-ethereum/crypto"
Expand Down Expand Up @@ -79,13 +75,3 @@ func (r *RPCRequest) Clone() *RPCRequest {
Params: r.Params,
}
}

// NewFileLogger is a logger factory function
func NewFileLogger() gethlog.Logger {
// Open or create your log file
file, err := os.OpenFile("gateway_logs.log", os.O_CREATE|os.O_APPEND|os.O_WRONLY, 0o644)
if err != nil {
panic(err)
}
return gethlog.NewLogger(gethlog.NewGlogHandler(gethforklog.NewTerminalHandler(file, false)))
}
2 changes: 1 addition & 1 deletion tools/walletextension/rpcapi/utils.go
Original file line number Diff line number Diff line change
Expand Up @@ -265,7 +265,7 @@ func withCache[R any](cache cache.Cache, cfg *CacheCfg, cacheKey []byte, onCache

func audit(services *Services, msg string, params ...any) {
if services.Config.VerboseFlag {
services.FileLogger.Info(fmt.Sprintf(msg, params...))
services.logger.Info(fmt.Sprintf(msg, params...))
}
}

Expand Down
3 changes: 0 additions & 3 deletions tools/walletextension/rpcapi/wallet_extension.go
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,6 @@ type Services struct {
HostAddrWS string // The WS address on which the Ten host can be reached
Storage storage.Storage
logger gethlog.Logger
FileLogger gethlog.Logger
stopControl *stopcontrol.StopControl
version string
Cache cache.Cache
Expand All @@ -58,7 +57,6 @@ type NewHeadNotifier interface {
}

func NewServices(hostAddrHTTP string, hostAddrWS string, storage storage.Storage, stopControl *stopcontrol.StopControl, version string, logger gethlog.Logger, config *common.Config) *Services {
newFileLogger := common.NewFileLogger()
newGatewayCache, err := cache.NewCache(logger)
if err != nil {
logger.Error(fmt.Errorf("could not create cache. Cause: %w", err).Error())
Expand Down Expand Up @@ -101,7 +99,6 @@ func NewServices(hostAddrHTTP string, hostAddrWS string, storage storage.Storage
HostAddrWS: hostAddrWS,
Storage: storage,
logger: logger,
FileLogger: newFileLogger,
stopControl: stopControl,
version: version,
Cache: newGatewayCache,
Expand Down

0 comments on commit 08556e6

Please sign in to comment.