From 90b6f712ea647b175af842cdc3a6f595c3f39003 Mon Sep 17 00:00:00 2001 From: Lukasz Klimek <842586+lklimek@users.noreply.github.com> Date: Thu, 19 Oct 2023 12:25:09 +0200 Subject: [PATCH] chore: remove unused newLoggerFromConfig after merge --- cmd/tenderdash/main.go | 29 ----------------------------- 1 file changed, 29 deletions(-) diff --git a/cmd/tenderdash/main.go b/cmd/tenderdash/main.go index d525416e6d..917af366dd 100644 --- a/cmd/tenderdash/main.go +++ b/cmd/tenderdash/main.go @@ -2,8 +2,6 @@ package main import ( "context" - "fmt" - "io" "os" "github.com/dashpay/tenderdash/cmd/tenderdash/commands" @@ -70,30 +68,3 @@ func main() { os.Exit(2) } } - -func newLoggerFromConfig(conf *config.Config) (log.Logger, func(), error) { - var ( - writer io.Writer = os.Stderr - closeFunc = func() {} - err error - ) - if conf.LogFilePath != "" { - file, err := os.OpenFile(conf.LogFilePath, os.O_WRONLY|os.O_CREATE|os.O_APPEND, 0644) - if err != nil { - return nil, nil, fmt.Errorf("failed to create log writer: %w", err) - } - closeFunc = func() { - _ = file.Close() - } - writer = io.MultiWriter(writer, file) - } - writer, err = log.NewFormatter(conf.LogFormat, writer) - if err != nil { - return nil, nil, fmt.Errorf("failed to create log formatter: %w", err) - } - logger, err := log.NewLogger(log.Level(conf.LogLevel), writer) - if err != nil { - return nil, nil, err - } - return logger, closeFunc, nil -}