Skip to content

Commit

Permalink
fix file logger
Browse files Browse the repository at this point in the history
  • Loading branch information
tudor-malene committed Apr 25, 2024
1 parent 740a78c commit 80599ec
Showing 1 changed file with 8 additions and 14 deletions.
22 changes: 8 additions & 14 deletions tools/walletextension/common/common.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"

Expand Down Expand Up @@ -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)))
}

0 comments on commit 80599ec

Please sign in to comment.