From 80599ec78a106ae665171d8419b9f45b775fd17f Mon Sep 17 00:00:00 2001 From: Tudor Malene Date: Thu, 25 Apr 2024 16:11:44 +0100 Subject: [PATCH] fix file logger --- tools/walletextension/common/common.go | 22 ++++++++-------------- 1 file changed, 8 insertions(+), 14 deletions(-) diff --git a/tools/walletextension/common/common.go b/tools/walletextension/common/common.go index 6be3b38ae7..a9a099b362 100644 --- a/tools/walletextension/common/common.go +++ b/tools/walletextension/common/common.go @@ -3,6 +3,9 @@ package common import ( "encoding/json" "fmt" + "os" + + gethforklog "github.com/ten-protocol/go-ten/lib/gethfork/log" gethrpc "github.com/ten-protocol/go-ten/lib/gethfork/rpc" @@ -80,18 +83,9 @@ func (r *RPCRequest) Clone() *RPCRequest { // 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) - //} - // - //err = debug.Setup("terminal", file.Name(), false, 10000000, 0, 0, false, false, slog.LevelDebug, "") - //if err != nil { - // panic(err) - //} - - // Create a new logger instance - logger := gethlog.New() - - return logger + 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))) }