Skip to content

Commit

Permalink
chore: remove unused newLoggerFromConfig after merge
Browse files Browse the repository at this point in the history
  • Loading branch information
lklimek committed Oct 19, 2023
1 parent 7716f8b commit 90b6f71
Showing 1 changed file with 0 additions and 29 deletions.
29 changes: 0 additions & 29 deletions cmd/tenderdash/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,6 @@ package main

import (
"context"
"fmt"
"io"
"os"

"github.com/dashpay/tenderdash/cmd/tenderdash/commands"
Expand Down Expand Up @@ -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
}

0 comments on commit 90b6f71

Please sign in to comment.